Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uffd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
rixx
uffd
Commits
f47756f4
Verified
Commit
f47756f4
authored
4 years ago
by
nd
Browse files
Options
Downloads
Patches
Plain Diff
enhance role view: use tabs, move buttons, stay on page after save
parent
165c4e98
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
uffd/role/templates/role.html
+112
-98
112 additions, 98 deletions
uffd/role/templates/role.html
uffd/role/views.py
+3
-1
3 additions, 1 deletion
uffd/role/views.py
uffd/user/templates/group.html
+1
-1
1 addition, 1 deletion
uffd/user/templates/group.html
with
116 additions
and
100 deletions
uffd/role/templates/role.html
+
112
−
98
View file @
f47756f4
...
@@ -3,6 +3,29 @@
...
@@ -3,6 +3,29 @@
{% block body %}
{% block body %}
<form
action=
"{{ url_for("
role.update
",
roleid=
role.id)
}}"
method=
"POST"
>
<form
action=
"{{ url_for("
role.update
",
roleid=
role.id)
}}"
method=
"POST"
>
<div
class=
"align-self-center"
>
<div
class=
"align-self-center"
>
<div
class=
"float-sm-right pb-2"
>
<button
type=
"submit"
class=
"btn btn-primary"
><i
class=
"fa fa-save"
aria-hidden=
"true"
></i>
Save
</button>
<a
href=
"{{ url_for("
role.index
")
}}"
class=
"btn btn-secondary"
>
Cancel
</a>
{% if role.id %}
<a
href=
"{{ url_for("
role.delete
",
roleid=
role.id)
}}"
onClick=
"return confirm('Are you sure?');"
class=
"btn btn-danger"
><i
class=
"fa fa-trash"
aria-hidden=
"true"
></i>
Delete
</a>
{% else %}
<a
href=
"#"
class=
"btn btn-danger disabled"
><i
class=
"fa fa-trash"
aria-hidden=
"true"
></i>
Delete
</a>
{% endif %}
</div>
<ul
class=
"nav nav-tabs pt-2 border-0"
id=
"tablist"
role=
"tablist"
>
<li
class=
"nav-item"
>
<a
class=
"nav-link active"
id=
"settings-tab"
data-toggle=
"tab"
href=
"#settings"
role=
"tab"
aria-controls=
"settings"
aria-selected=
"true"
>
Settings
</a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
id=
"roles-tab"
data-toggle=
"tab"
href=
"#roles"
role=
"tab"
aria-controls=
"roles"
aria-selected=
"false"
>
Included roles
<span
class=
"badge badge-pill badge-secondary"
>
{{ role.included_roles|length }}
</span></a>
</li>
<li
class=
"nav-item"
>
<a
class=
"nav-link"
id=
"groups-tab"
data-toggle=
"tab"
href=
"#groups"
role=
"tab"
aria-controls=
"groups"
aria-selected=
"false"
>
Included groups
<span
class=
"badge badge-pill badge-secondary"
>
{{ role.groups|length }}
</span></a>
</li>
</ul>
<div
class=
"tab-content border mb-2 pt-2"
id=
"tabcontent"
>
<div
class=
"tab-pane fade show active"
id=
"settings"
role=
"tabpanel"
aria-labelledby=
"settings-tab"
>
<div
class=
"form-group col"
>
<div
class=
"form-group col"
>
<label
for=
"role-name"
>
Role Name
</label>
<label
for=
"role-name"
>
Role Name
</label>
<input
type=
"text"
class=
"form-control"
id=
"role-name"
name=
"name"
value=
"{{ role.name }}"
>
<input
type=
"text"
class=
"form-control"
id=
"role-name"
name=
"name"
value=
"{{ role.name }}"
>
...
@@ -15,7 +38,16 @@
...
@@ -15,7 +38,16 @@
<small
class=
"form-text text-muted"
>
<small
class=
"form-text text-muted"
>
</small>
</small>
</div>
</div>
<div
class=
"form-group col"
>
<span>
Members:
</span>
<ul
class=
"row"
>
{% for member in role.members|sort(attribute='loginname') %}
<li
class=
"col-12 col-xs-6 col-sm-4 col-md-3 col-lg-2"
><a
href=
"{{ url_for("
user.show
",
uid=
member.uid)
}}"
>
{{ member.loginname }}
</a></li>
{% endfor %}
</ul>
</div>
</div>
<div
class=
"tab-pane fade"
id=
"roles"
role=
"tabpanel"
aria-labelledby=
"roles-tab"
>
<div
class=
"form-group col"
>
<div
class=
"form-group col"
>
<span>
Roles to include groups from recursively
</span>
<span>
Roles to include groups from recursively
</span>
<table
class=
"table table-striped table-sm"
>
<table
class=
"table table-striped table-sm"
>
...
@@ -55,7 +87,8 @@
...
@@ -55,7 +87,8 @@
</tbody>
</tbody>
</table>
</table>
</div>
</div>
</div>
<div
class=
"tab-pane fade"
id=
"groups"
role=
"tabpanel"
aria-labelledby=
"groups-tab"
>
<div
class=
"form-group col"
>
<div
class=
"form-group col"
>
<span>
Included groups
</span>
<span>
Included groups
</span>
<table
class=
"table table-striped table-sm"
>
<table
class=
"table table-striped table-sm"
>
...
@@ -87,26 +120,7 @@
...
@@ -87,26 +120,7 @@
</tbody>
</tbody>
</table>
</table>
</div>
</div>
<div
class=
"form-group col"
>
<p>
Members
</p>
<ul>
{% for dbmember in role.db_members %}
<li>
{{ dbmember.dn }}
</li>
{% endfor %}
</ul>
</div>
</div>
<div
class=
"form-group col"
>
<button
type=
"submit"
class=
"btn btn-primary"
><i
class=
"fa fa-save"
aria-hidden=
"true"
></i>
Save
</button>
<a
href=
"{{ url_for("
role.index
")
}}"
class=
"btn btn-secondary"
>
Cancel
</a>
{% if role.id %}
<a
href=
"{{ url_for("
role.delete
",
roleid=
role.id)
}}"
class=
"btn btn-danger"
><i
class=
"fa fa-trash"
aria-hidden=
"true"
></i>
Delete
</a>
{% else %}
<a
href=
"#"
class=
"btn btn-danger disabled"
><i
class=
"fa fa-trash"
aria-hidden=
"true"
></i>
Delete
</a>
{% endif %}
</div>
</div>
</div>
</div>
</form>
</form>
...
...
This diff is collapsed.
Click to expand it.
uffd/role/views.py
+
3
−
1
View file @
f47756f4
...
@@ -54,6 +54,8 @@ def index():
...
@@ -54,6 +54,8 @@ def index():
@bp.route
(
"
/<int:roleid>
"
)
@bp.route
(
"
/<int:roleid>
"
)
@bp.route
(
"
/new
"
)
@bp.route
(
"
/new
"
)
def
show
(
roleid
=
False
):
def
show
(
roleid
=
False
):
# prefetch all users so the ldap orm can cache them and doesn't run one ldap query per user
User
.
query
.
all
()
if
not
roleid
:
if
not
roleid
:
role
=
Role
()
role
=
Role
()
else
:
else
:
...
@@ -85,7 +87,7 @@ def update(roleid=False):
...
@@ -85,7 +87,7 @@ def update(roleid=False):
role
.
update_member_groups
()
role
.
update_member_groups
()
db
.
session
.
commit
()
db
.
session
.
commit
()
ldap
.
session
.
commit
()
ldap
.
session
.
commit
()
return
redirect
(
url_for
(
'
role.
index
'
))
return
redirect
(
url_for
(
'
role.
show
'
,
roleid
=
roleid
))
@bp.route
(
"
/<int:roleid>/del
"
)
@bp.route
(
"
/<int:roleid>/del
"
)
@csrf_protect
(
blueprint
=
bp
)
@csrf_protect
(
blueprint
=
bp
)
...
...
This diff is collapsed.
Click to expand it.
uffd/user/templates/group.html
+
1
−
1
View file @
f47756f4
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
<div
class=
"col"
>
<div
class=
"col"
>
<span>
Members:
</span>
<span>
Members:
</span>
<ul
class=
"row"
>
<ul
class=
"row"
>
{% for member in group.members %}
{% for member in group.members
|sort(attribute='loginname')
%}
<li
class=
"col-12 col-xs-6 col-sm-4 col-md-3 col-lg-2"
><a
href=
"{{ url_for("
user.show
",
uid=
member.uid)
}}"
>
{{ member.loginname }}
</a></li>
<li
class=
"col-12 col-xs-6 col-sm-4 col-md-3 col-lg-2"
><a
href=
"{{ url_for("
user.show
",
uid=
member.uid)
}}"
>
{{ member.loginname }}
</a></li>
{% endfor %}
{% endfor %}
</ul>
</ul>
...
...
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