-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
52de54e
commit c36ace0
Showing
7 changed files
with
179 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright Red Hat | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
from rest_framework.permissions import IsAuthenticated | ||
|
||
|
||
class IsAuthenticatedRHEmployee(IsAuthenticated): | ||
""" | ||
Allow access only to users who are authenticated Red Hat employees. | ||
""" | ||
|
||
code = "permission_denied__user_not_authenticated_rh_employee" | ||
message = "The User is not an authenticated Red Hat employee." | ||
|
||
def has_permission(self, request, view): | ||
permitted = super().has_permission(request, view) | ||
if not permitted: | ||
return permitted | ||
|
||
user = request.user | ||
return user.rh_employee |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Ansible AI Connect Chatbot</title> | ||
</head> | ||
<body> | ||
<p>THIS IS A PLACEHOLDER</p> | ||
</body> | ||
{% block content %} | ||
<noscript>You need to enable JavaScript to run this app.</noscript> | ||
<!-- The chatbot needs to show the userName --> | ||
<!-- It is safe to pass the value embedded in the host DOM --> | ||
<!-- as it is only used for display purposes and servers no other value --> | ||
<div id="user_name" hidden>{{user_name}}</div> | ||
{% endblock content %} | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters