Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
PEDASI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Research Software Group
PEDASI
Commits
a97eefed
Commit
a97eefed
authored
6 years ago
by
James Graham
Browse files
Options
Downloads
Patches
Plain Diff
Add UUID to application proxy usernames - fixes
#67
parent
dc11d4d0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
applications/models.py
+4
-1
4 additions, 1 deletion
applications/models.py
datasources/templates/datasources/datasource/manage_access.html
+16
-2
16 additions, 2 deletions
...urces/templates/datasources/datasource/manage_access.html
with
20 additions
and
3 deletions
applications/models.py
+
4
−
1
View file @
a97eefed
from
uuid
import
uuid4
from
django.contrib.auth
import
get_user_model
from
django.contrib.auth.models
import
Group
from
django.conf
import
settings
...
...
@@ -127,7 +129,8 @@ class Application(ProvAbleModel, ProvApplicationModel, BaseAppDataModel):
if
self
.
proxy_user
:
return
self
.
proxy_user
proxy_username
=
'
application-proxy-
'
+
slugify
(
self
.
name
)
# Add random UUID to username to allow multiple applications with the same name
proxy_username
=
'
application-proxy-
'
+
slugify
(
self
.
name
)
+
str
(
uuid4
())
proxy_user
=
get_user_model
().
objects
.
create_user
(
proxy_username
)
# Create an API access token for the proxy user
...
...
This diff is collapsed.
Click to expand it.
datasources/templates/datasources/datasource/manage_access.html
+
16
−
2
View file @
a97eefed
...
...
@@ -47,7 +47,13 @@
<tr
id=
"requested-user-{{ permission.user.pk }}"
>
<td>
<p>
{{ permission.user.username }}
{% if permission.user.application_proxy %}
{{ permission.user.application_proxy.name }}
<a
href=
"{% url 'applications:application.detail' pk=permission.user.application_proxy.pk %}"
role=
"button"
class=
"badge badge-info"
>
App
</a>
{% else %}
{{ permission.user.username }}
{% endif %}
</p>
{% if permission.reason %}
<div
class=
"alert alert-secondary"
role=
"note"
>
...
...
@@ -105,7 +111,15 @@
<tbody>
{% for permission in permissions_granted %}
<tr
id=
"approved-user-{{ permission.user.pk }}"
>
<td>
{{ permission.user.username }}
</td>
<td>
{% if permission.user.application_proxy %}
{{ permission.user.application_proxy.name }}
<a
href=
"{% url 'applications:application.detail' pk=permission.user.application_proxy.pk %}"
role=
"button"
class=
"badge badge-info"
>
App
</a>
{% else %}
{{ permission.user.username }}
{% endif %}
</td>
<td>
{{ permission.get_requested_display }}
</td>
<td>
{{ permission.get_granted_display }}
</td>
<td>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment