Show More
@@ -1376,6 +1376,32 b' class UserGroup(Base, BaseModel):' | |||||
1376 | return user_group.get(user_group_id) |
|
1376 | return user_group.get(user_group_id) | |
1377 |
|
1377 | |||
1378 | def permissions(self, with_admins=True, with_owner=True): |
|
1378 | def permissions(self, with_admins=True, with_owner=True): | |
|
1379 | """ | |||
|
1380 | Permissions for user groups | |||
|
1381 | """ | |||
|
1382 | _admin_perm = 'usergroup.admin' | |||
|
1383 | ||||
|
1384 | owner_row = [] | |||
|
1385 | if with_owner: | |||
|
1386 | usr = AttributeDict(self.user.get_dict()) | |||
|
1387 | usr.owner_row = True | |||
|
1388 | usr.permission = _admin_perm | |||
|
1389 | owner_row.append(usr) | |||
|
1390 | ||||
|
1391 | super_admin_ids = [] | |||
|
1392 | super_admin_rows = [] | |||
|
1393 | if with_admins: | |||
|
1394 | for usr in User.get_all_super_admins(): | |||
|
1395 | super_admin_ids.append(usr.user_id) | |||
|
1396 | # if this admin is also owner, don't double the record | |||
|
1397 | if usr.user_id == owner_row[0].user_id: | |||
|
1398 | owner_row[0].admin_row = True | |||
|
1399 | else: | |||
|
1400 | usr = AttributeDict(usr.get_dict()) | |||
|
1401 | usr.admin_row = True | |||
|
1402 | usr.permission = _admin_perm | |||
|
1403 | super_admin_rows.append(usr) | |||
|
1404 | ||||
1379 | q = UserUserGroupToPerm.query().filter(UserUserGroupToPerm.user_group == self) |
|
1405 | q = UserUserGroupToPerm.query().filter(UserUserGroupToPerm.user_group == self) | |
1380 | q = q.options(joinedload(UserUserGroupToPerm.user_group), |
|
1406 | q = q.options(joinedload(UserUserGroupToPerm.user_group), | |
1381 | joinedload(UserUserGroupToPerm.user), |
|
1407 | joinedload(UserUserGroupToPerm.user), | |
@@ -1389,6 +1415,9 b' class UserGroup(Base, BaseModel):' | |||||
1389 | perm_rows = [] |
|
1415 | perm_rows = [] | |
1390 | for _usr in q.all(): |
|
1416 | for _usr in q.all(): | |
1391 | usr = AttributeDict(_usr.user.get_dict()) |
|
1417 | usr = AttributeDict(_usr.user.get_dict()) | |
|
1418 | # if this user is also owner/admin, mark as duplicate record | |||
|
1419 | if usr.user_id == owner_row[0].user_id or usr.user_id in super_admin_ids: | |||
|
1420 | usr.duplicate_perm = True | |||
1392 | usr.permission = _usr.permission.permission_name |
|
1421 | usr.permission = _usr.permission.permission_name | |
1393 | perm_rows.append(usr) |
|
1422 | perm_rows.append(usr) | |
1394 |
|
1423 | |||
@@ -1397,26 +1426,6 b' class UserGroup(Base, BaseModel):' | |||||
1397 | # each group |
|
1426 | # each group | |
1398 | perm_rows = sorted(perm_rows, key=display_user_sort) |
|
1427 | perm_rows = sorted(perm_rows, key=display_user_sort) | |
1399 |
|
1428 | |||
1400 | _admin_perm = 'usergroup.admin' |
|
|||
1401 | owner_row = [] |
|
|||
1402 | if with_owner: |
|
|||
1403 | usr = AttributeDict(self.user.get_dict()) |
|
|||
1404 | usr.owner_row = True |
|
|||
1405 | usr.permission = _admin_perm |
|
|||
1406 | owner_row.append(usr) |
|
|||
1407 |
|
||||
1408 | super_admin_rows = [] |
|
|||
1409 | if with_admins: |
|
|||
1410 | for usr in User.get_all_super_admins(): |
|
|||
1411 | # if this admin is also owner, don't double the record |
|
|||
1412 | if usr.user_id == owner_row[0].user_id: |
|
|||
1413 | owner_row[0].admin_row = True |
|
|||
1414 | else: |
|
|||
1415 | usr = AttributeDict(usr.get_dict()) |
|
|||
1416 | usr.admin_row = True |
|
|||
1417 | usr.permission = _admin_perm |
|
|||
1418 | super_admin_rows.append(usr) |
|
|||
1419 |
|
||||
1420 | return super_admin_rows + owner_row + perm_rows |
|
1429 | return super_admin_rows + owner_row + perm_rows | |
1421 |
|
1430 | |||
1422 | def permission_user_groups(self): |
|
1431 | def permission_user_groups(self): | |
@@ -1899,6 +1908,34 b' class Repository(Base, BaseModel):' | |||||
1899 | return make_db_config(clear_session=False, repo=self) |
|
1908 | return make_db_config(clear_session=False, repo=self) | |
1900 |
|
1909 | |||
1901 | def permissions(self, with_admins=True, with_owner=True): |
|
1910 | def permissions(self, with_admins=True, with_owner=True): | |
|
1911 | """ | |||
|
1912 | Permissions for repositories | |||
|
1913 | """ | |||
|
1914 | _admin_perm = 'repository.admin' | |||
|
1915 | ||||
|
1916 | owner_row = [] | |||
|
1917 | if with_owner: | |||
|
1918 | usr = AttributeDict(self.user.get_dict()) | |||
|
1919 | usr.owner_row = True | |||
|
1920 | usr.permission = _admin_perm | |||
|
1921 | usr.permission_id = None | |||
|
1922 | owner_row.append(usr) | |||
|
1923 | ||||
|
1924 | super_admin_ids = [] | |||
|
1925 | super_admin_rows = [] | |||
|
1926 | if with_admins: | |||
|
1927 | for usr in User.get_all_super_admins(): | |||
|
1928 | super_admin_ids.append(usr.user_id) | |||
|
1929 | # if this admin is also owner, don't double the record | |||
|
1930 | if usr.user_id == owner_row[0].user_id: | |||
|
1931 | owner_row[0].admin_row = True | |||
|
1932 | else: | |||
|
1933 | usr = AttributeDict(usr.get_dict()) | |||
|
1934 | usr.admin_row = True | |||
|
1935 | usr.permission = _admin_perm | |||
|
1936 | usr.permission_id = None | |||
|
1937 | super_admin_rows.append(usr) | |||
|
1938 | ||||
1902 | q = UserRepoToPerm.query().filter(UserRepoToPerm.repository == self) |
|
1939 | q = UserRepoToPerm.query().filter(UserRepoToPerm.repository == self) | |
1903 | q = q.options(joinedload(UserRepoToPerm.repository), |
|
1940 | q = q.options(joinedload(UserRepoToPerm.repository), | |
1904 | joinedload(UserRepoToPerm.user), |
|
1941 | joinedload(UserRepoToPerm.user), | |
@@ -1912,6 +1949,9 b' class Repository(Base, BaseModel):' | |||||
1912 | perm_rows = [] |
|
1949 | perm_rows = [] | |
1913 | for _usr in q.all(): |
|
1950 | for _usr in q.all(): | |
1914 | usr = AttributeDict(_usr.user.get_dict()) |
|
1951 | usr = AttributeDict(_usr.user.get_dict()) | |
|
1952 | # if this user is also owner/admin, mark as duplicate record | |||
|
1953 | if usr.user_id == owner_row[0].user_id or usr.user_id in super_admin_ids: | |||
|
1954 | usr.duplicate_perm = True | |||
1915 | usr.permission = _usr.permission.permission_name |
|
1955 | usr.permission = _usr.permission.permission_name | |
1916 | usr.permission_id = _usr.repo_to_perm_id |
|
1956 | usr.permission_id = _usr.repo_to_perm_id | |
1917 | perm_rows.append(usr) |
|
1957 | perm_rows.append(usr) | |
@@ -1921,28 +1961,6 b' class Repository(Base, BaseModel):' | |||||
1921 | # each group |
|
1961 | # each group | |
1922 | perm_rows = sorted(perm_rows, key=display_user_sort) |
|
1962 | perm_rows = sorted(perm_rows, key=display_user_sort) | |
1923 |
|
1963 | |||
1924 | _admin_perm = 'repository.admin' |
|
|||
1925 | owner_row = [] |
|
|||
1926 | if with_owner: |
|
|||
1927 | usr = AttributeDict(self.user.get_dict()) |
|
|||
1928 | usr.owner_row = True |
|
|||
1929 | usr.permission = _admin_perm |
|
|||
1930 | usr.permission_id = None |
|
|||
1931 | owner_row.append(usr) |
|
|||
1932 |
|
||||
1933 | super_admin_rows = [] |
|
|||
1934 | if with_admins: |
|
|||
1935 | for usr in User.get_all_super_admins(): |
|
|||
1936 | # if this admin is also owner, don't double the record |
|
|||
1937 | if usr.user_id == owner_row[0].user_id: |
|
|||
1938 | owner_row[0].admin_row = True |
|
|||
1939 | else: |
|
|||
1940 | usr = AttributeDict(usr.get_dict()) |
|
|||
1941 | usr.admin_row = True |
|
|||
1942 | usr.permission = _admin_perm |
|
|||
1943 | usr.permission_id = None |
|
|||
1944 | super_admin_rows.append(usr) |
|
|||
1945 |
|
||||
1946 | return super_admin_rows + owner_row + perm_rows |
|
1964 | return super_admin_rows + owner_row + perm_rows | |
1947 |
|
1965 | |||
1948 | def permission_user_groups(self): |
|
1966 | def permission_user_groups(self): | |
@@ -2597,6 +2615,32 b' class RepoGroup(Base, BaseModel):' | |||||
2597 | return RepoGroup.url_sep().join(path_prefix + [group_name]) |
|
2615 | return RepoGroup.url_sep().join(path_prefix + [group_name]) | |
2598 |
|
2616 | |||
2599 | def permissions(self, with_admins=True, with_owner=True): |
|
2617 | def permissions(self, with_admins=True, with_owner=True): | |
|
2618 | """ | |||
|
2619 | Permissions for repository groups | |||
|
2620 | """ | |||
|
2621 | _admin_perm = 'group.admin' | |||
|
2622 | ||||
|
2623 | owner_row = [] | |||
|
2624 | if with_owner: | |||
|
2625 | usr = AttributeDict(self.user.get_dict()) | |||
|
2626 | usr.owner_row = True | |||
|
2627 | usr.permission = _admin_perm | |||
|
2628 | owner_row.append(usr) | |||
|
2629 | ||||
|
2630 | super_admin_ids = [] | |||
|
2631 | super_admin_rows = [] | |||
|
2632 | if with_admins: | |||
|
2633 | for usr in User.get_all_super_admins(): | |||
|
2634 | super_admin_ids.append(usr.user_id) | |||
|
2635 | # if this admin is also owner, don't double the record | |||
|
2636 | if usr.user_id == owner_row[0].user_id: | |||
|
2637 | owner_row[0].admin_row = True | |||
|
2638 | else: | |||
|
2639 | usr = AttributeDict(usr.get_dict()) | |||
|
2640 | usr.admin_row = True | |||
|
2641 | usr.permission = _admin_perm | |||
|
2642 | super_admin_rows.append(usr) | |||
|
2643 | ||||
2600 | q = UserRepoGroupToPerm.query().filter(UserRepoGroupToPerm.group == self) |
|
2644 | q = UserRepoGroupToPerm.query().filter(UserRepoGroupToPerm.group == self) | |
2601 | q = q.options(joinedload(UserRepoGroupToPerm.group), |
|
2645 | q = q.options(joinedload(UserRepoGroupToPerm.group), | |
2602 | joinedload(UserRepoGroupToPerm.user), |
|
2646 | joinedload(UserRepoGroupToPerm.user), | |
@@ -2610,6 +2654,9 b' class RepoGroup(Base, BaseModel):' | |||||
2610 | perm_rows = [] |
|
2654 | perm_rows = [] | |
2611 | for _usr in q.all(): |
|
2655 | for _usr in q.all(): | |
2612 | usr = AttributeDict(_usr.user.get_dict()) |
|
2656 | usr = AttributeDict(_usr.user.get_dict()) | |
|
2657 | # if this user is also owner/admin, mark as duplicate record | |||
|
2658 | if usr.user_id == owner_row[0].user_id or usr.user_id in super_admin_ids: | |||
|
2659 | usr.duplicate_perm = True | |||
2613 | usr.permission = _usr.permission.permission_name |
|
2660 | usr.permission = _usr.permission.permission_name | |
2614 | perm_rows.append(usr) |
|
2661 | perm_rows.append(usr) | |
2615 |
|
2662 | |||
@@ -2618,30 +2665,11 b' class RepoGroup(Base, BaseModel):' | |||||
2618 | # each group |
|
2665 | # each group | |
2619 | perm_rows = sorted(perm_rows, key=display_user_sort) |
|
2666 | perm_rows = sorted(perm_rows, key=display_user_sort) | |
2620 |
|
2667 | |||
2621 | _admin_perm = 'group.admin' |
|
|||
2622 | owner_row = [] |
|
|||
2623 | if with_owner: |
|
|||
2624 | usr = AttributeDict(self.user.get_dict()) |
|
|||
2625 | usr.owner_row = True |
|
|||
2626 | usr.permission = _admin_perm |
|
|||
2627 | owner_row.append(usr) |
|
|||
2628 |
|
||||
2629 | super_admin_rows = [] |
|
|||
2630 | if with_admins: |
|
|||
2631 | for usr in User.get_all_super_admins(): |
|
|||
2632 | # if this admin is also owner, don't double the record |
|
|||
2633 | if usr.user_id == owner_row[0].user_id: |
|
|||
2634 | owner_row[0].admin_row = True |
|
|||
2635 | else: |
|
|||
2636 | usr = AttributeDict(usr.get_dict()) |
|
|||
2637 | usr.admin_row = True |
|
|||
2638 | usr.permission = _admin_perm |
|
|||
2639 | super_admin_rows.append(usr) |
|
|||
2640 |
|
||||
2641 | return super_admin_rows + owner_row + perm_rows |
|
2668 | return super_admin_rows + owner_row + perm_rows | |
2642 |
|
2669 | |||
2643 | def permission_user_groups(self): |
|
2670 | def permission_user_groups(self): | |
2644 |
q = UserGroupRepoGroupToPerm.query().filter( |
|
2671 | q = UserGroupRepoGroupToPerm.query().filter( | |
|
2672 | UserGroupRepoGroupToPerm.group == self) | |||
2645 | q = q.options(joinedload(UserGroupRepoGroupToPerm.group), |
|
2673 | q = q.options(joinedload(UserGroupRepoGroupToPerm.group), | |
2646 | joinedload(UserGroupRepoGroupToPerm.users_group), |
|
2674 | joinedload(UserGroupRepoGroupToPerm.users_group), | |
2647 | joinedload(UserGroupRepoGroupToPerm.permission),) |
|
2675 | joinedload(UserGroupRepoGroupToPerm.permission),) |
@@ -32,6 +32,7 b' var addNewPermInput = function(node, per' | |||||
32 | ' </div>'+ |
|
32 | ' </div>'+ | |
33 | '</td>'+ |
|
33 | '</td>'+ | |
34 | '<td></td>'+ |
|
34 | '<td></td>'+ | |
|
35 | '<td></td>'+ | |||
35 | '</tr>'; |
|
36 | '</tr>'; | |
36 | var _next_id = 'new'+$('.new_members').length; |
|
37 | var _next_id = 'new'+$('.new_members').length; | |
37 | _html = _html.format(_next_id, permission_type); |
|
38 | _html = _html.format(_next_id, permission_type); |
@@ -14,9 +14,11 b'' | |||||
14 | <th class="td-radio">${_('Admin')}</th> |
|
14 | <th class="td-radio">${_('Admin')}</th> | |
15 | <th class="td-owner">${_('User/User Group')}</th> |
|
15 | <th class="td-owner">${_('User/User Group')}</th> | |
16 | <th></th> |
|
16 | <th></th> | |
|
17 | <th></th> | |||
17 | </tr> |
|
18 | </tr> | |
18 | ## USERS |
|
19 | ## USERS | |
19 | %for _user in c.repo_group.permissions(): |
|
20 | %for _user in c.repo_group.permissions(): | |
|
21 | ## super admin/owner row | |||
20 | %if getattr(_user, 'admin_row', None) or getattr(_user, 'owner_row', None): |
|
22 | %if getattr(_user, 'admin_row', None) or getattr(_user, 'owner_row', None): | |
21 | <tr class="perm_admin_row"> |
|
23 | <tr class="perm_admin_row"> | |
22 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.none', disabled="disabled")}</td> |
|
24 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.none', disabled="disabled")}</td> | |
@@ -34,6 +36,11 b'' | |||||
34 | %endif |
|
36 | %endif | |
35 | </td> |
|
37 | </td> | |
36 | <td></td> |
|
38 | <td></td> | |
|
39 | <td> | |||
|
40 | % if c.rhodecode_user.is_admin: | |||
|
41 | ${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))} | |||
|
42 | % endif | |||
|
43 | </td> | |||
37 | </tr> |
|
44 | </tr> | |
38 | %else: |
|
45 | %else: | |
39 | <tr> |
|
46 | <tr> | |
@@ -50,6 +57,9 b'' | |||||
50 | ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span> |
|
57 | ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span> | |
51 | % else: |
|
58 | % else: | |
52 | ${h.link_to_user(_user.username)} |
|
59 | ${h.link_to_user(_user.username)} | |
|
60 | %if getattr(_user, 'duplicate_perm', None): | |||
|
61 | (${_('inactive duplicate')}) | |||
|
62 | %endif | |||
53 | % endif |
|
63 | % endif | |
54 | </span> |
|
64 | </span> | |
55 | </td> |
|
65 | </td> | |
@@ -61,8 +71,17 b'' | |||||
61 | </span> |
|
71 | </span> | |
62 | %endif |
|
72 | %endif | |
63 | </td> |
|
73 | </td> | |
|
74 | <td> | |||
|
75 | % if c.rhodecode_user.is_admin: | |||
|
76 | % if _user.username == h.DEFAULT_USER: | |||
|
77 | ${h.link_to('show permissions', h.route_path('admin_permissions_overview', _anchor='repositories-permissions'))} | |||
64 | %else: |
|
78 | % else: | |
65 | ## special case for current user permissions, we make sure he cannot take his own permissions |
|
79 | ${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))} | |
|
80 | % endif | |||
|
81 | % endif | |||
|
82 | </td> | |||
|
83 | %else: | |||
|
84 | ## special case for currently logged-in user permissions, we make sure he cannot take his own permissions | |||
66 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.none', disabled="disabled")}</td> |
|
85 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.none', disabled="disabled")}</td> | |
67 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.read', disabled="disabled")}</td> |
|
86 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.read', disabled="disabled")}</td> | |
68 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.write', disabled="disabled")}</td> |
|
87 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.write', disabled="disabled")}</td> | |
@@ -74,11 +93,19 b'' | |||||
74 | ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span> |
|
93 | ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span> | |
75 | % else: |
|
94 | % else: | |
76 | ${h.link_to_user(_user.username)} |
|
95 | ${h.link_to_user(_user.username)} | |
|
96 | %if getattr(_user, 'duplicate_perm', None): | |||
|
97 | (${_('inactive duplicate')}) | |||
|
98 | %endif | |||
77 | % endif |
|
99 | % endif | |
78 | <span class="user-perm-help-text">(${_('delegated admin')})</span> |
|
100 | <span class="user-perm-help-text">(${_('delegated admin')})</span> | |
79 | </span> |
|
101 | </span> | |
80 | </td> |
|
102 | </td> | |
81 | <td></td> |
|
103 | <td></td> | |
|
104 | <td> | |||
|
105 | % if c.rhodecode_user.is_admin: | |||
|
106 | ${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))} | |||
|
107 | % endif | |||
|
108 | </td> | |||
82 | %endif |
|
109 | %endif | |
83 | </tr> |
|
110 | </tr> | |
84 | %endif |
|
111 | %endif | |
@@ -107,6 +134,11 b'' | |||||
107 | ${_('Revoke')} |
|
134 | ${_('Revoke')} | |
108 | </span> |
|
135 | </span> | |
109 | </td> |
|
136 | </td> | |
|
137 | <td> | |||
|
138 | % if c.rhodecode_user.is_admin: | |||
|
139 | ${h.link_to('show permissions', h.route_path('edit_user_group_perms_summary', user_group_id=_user_group.users_group_id, _anchor='repositories-permissions'))} | |||
|
140 | % endif | |||
|
141 | </td> | |||
110 | </tr> |
|
142 | </tr> | |
111 | %endfor |
|
143 | %endfor | |
112 |
|
144 | |||
@@ -122,6 +154,7 b'' | |||||
122 | ${_('Add user/user group')} |
|
154 | ${_('Add user/user group')} | |
123 | </span> |
|
155 | </span> | |
124 | </td> |
|
156 | </td> | |
|
157 | <td></td> | |||
125 | </tr> |
|
158 | </tr> | |
126 | </table> |
|
159 | </table> | |
127 |
|
160 |
@@ -14,6 +14,7 b'' | |||||
14 | <th class="td-radio">${_('Admin')}</th> |
|
14 | <th class="td-radio">${_('Admin')}</th> | |
15 | <th class="td-owner">${_('User/User Group')}</th> |
|
15 | <th class="td-owner">${_('User/User Group')}</th> | |
16 | <th></th> |
|
16 | <th></th> | |
|
17 | <th></th> | |||
17 | </tr> |
|
18 | </tr> | |
18 | ## USERS |
|
19 | ## USERS | |
19 | %for _user in c.rhodecode_db_repo.permissions(): |
|
20 | %for _user in c.rhodecode_db_repo.permissions(): | |
@@ -34,6 +35,11 b'' | |||||
34 | %endif |
|
35 | %endif | |
35 | </td> |
|
36 | </td> | |
36 | <td></td> |
|
37 | <td></td> | |
|
38 | <td> | |||
|
39 | % if c.rhodecode_user.is_admin: | |||
|
40 | ${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))} | |||
|
41 | % endif | |||
|
42 | </td> | |||
37 | </tr> |
|
43 | </tr> | |
38 | %elif _user.username == h.DEFAULT_USER and c.rhodecode_db_repo.private: |
|
44 | %elif _user.username == h.DEFAULT_USER and c.rhodecode_db_repo.private: | |
39 | <tr> |
|
45 | <tr> | |
@@ -46,6 +52,11 b'' | |||||
46 | ${base.gravatar(h.DEFAULT_USER_EMAIL, 16)} |
|
52 | ${base.gravatar(h.DEFAULT_USER_EMAIL, 16)} | |
47 | ${h.DEFAULT_USER} - ${_('only users/user groups explicitly added here will have access')}</td> |
|
53 | ${h.DEFAULT_USER} - ${_('only users/user groups explicitly added here will have access')}</td> | |
48 | <td></td> |
|
54 | <td></td> | |
|
55 | <td> | |||
|
56 | % if c.rhodecode_user.is_admin: | |||
|
57 | ${h.link_to('show permissions', h.route_path('admin_permissions_overview', _anchor='repositories-permissions'))} | |||
|
58 | % endif | |||
|
59 | </td> | |||
49 | </tr> |
|
60 | </tr> | |
50 | %else: |
|
61 | %else: | |
51 | <tr> |
|
62 | <tr> | |
@@ -60,6 +71,9 b'' | |||||
60 | ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span> |
|
71 | ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span> | |
61 | % else: |
|
72 | % else: | |
62 | ${h.link_to_user(_user.username)} |
|
73 | ${h.link_to_user(_user.username)} | |
|
74 | %if getattr(_user, 'duplicate_perm', None): | |||
|
75 | (${_('inactive duplicate')}) | |||
|
76 | %endif | |||
63 | % endif |
|
77 | % endif | |
64 | </span> |
|
78 | </span> | |
65 | </td> |
|
79 | </td> | |
@@ -71,6 +85,15 b'' | |||||
71 | </span> |
|
85 | </span> | |
72 | %endif |
|
86 | %endif | |
73 | </td> |
|
87 | </td> | |
|
88 | <td> | |||
|
89 | % if c.rhodecode_user.is_admin: | |||
|
90 | % if _user.username == h.DEFAULT_USER: | |||
|
91 | ${h.link_to('show permissions', h.route_path('admin_permissions_overview', _anchor='repositories-permissions'))} | |||
|
92 | % else: | |||
|
93 | ${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))} | |||
|
94 | % endif | |||
|
95 | % endif | |||
|
96 | </td> | |||
74 | </tr> |
|
97 | </tr> | |
75 | %endif |
|
98 | %endif | |
76 | %endfor |
|
99 | %endfor | |
@@ -98,6 +121,11 b'' | |||||
98 | ${_('Revoke')} |
|
121 | ${_('Revoke')} | |
99 | </span> |
|
122 | </span> | |
100 | </td> |
|
123 | </td> | |
|
124 | <td> | |||
|
125 | % if c.rhodecode_user.is_admin: | |||
|
126 | ${h.link_to('show permissions', h.route_path('edit_user_group_perms_summary', user_group_id=_user_group.users_group_id, _anchor='repositories-permissions'))} | |||
|
127 | % endif | |||
|
128 | </td> | |||
101 | </tr> |
|
129 | </tr> | |
102 | %endfor |
|
130 | %endfor | |
103 | <tr class="new_members" id="add_perm_input"></tr> |
|
131 | <tr class="new_members" id="add_perm_input"></tr> | |
@@ -113,6 +141,7 b'' | |||||
113 | ${_('Add user/user group')} |
|
141 | ${_('Add user/user group')} | |
114 | </span> |
|
142 | </span> | |
115 | </td> |
|
143 | </td> | |
|
144 | <td></td> | |||
116 | </tr> |
|
145 | </tr> | |
117 |
|
146 | |||
118 | </table> |
|
147 | </table> |
@@ -14,9 +14,11 b'' | |||||
14 | <th class="td-radio">${_('Admin')}</th> |
|
14 | <th class="td-radio">${_('Admin')}</th> | |
15 | <th>${_('User/User Group')}</th> |
|
15 | <th>${_('User/User Group')}</th> | |
16 | <th></th> |
|
16 | <th></th> | |
|
17 | <th></th> | |||
17 | </tr> |
|
18 | </tr> | |
18 | ## USERS |
|
19 | ## USERS | |
19 | %for _user in c.user_group.permissions(): |
|
20 | %for _user in c.user_group.permissions(): | |
|
21 | ## super admin/owner row | |||
20 | %if getattr(_user, 'admin_row', None) or getattr(_user, 'owner_row', None): |
|
22 | %if getattr(_user, 'admin_row', None) or getattr(_user, 'owner_row', None): | |
21 | <tr class="perm_admin_row"> |
|
23 | <tr class="perm_admin_row"> | |
22 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.none', disabled="disabled")}</td> |
|
24 | <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.none', disabled="disabled")}</td> | |
@@ -36,6 +38,11 b'' | |||||
36 | </span> |
|
38 | </span> | |
37 | </td> |
|
39 | </td> | |
38 | <td></td> |
|
40 | <td></td> | |
|
41 | <td> | |||
|
42 | % if c.rhodecode_user.is_admin: | |||
|
43 | ${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))} | |||
|
44 | % endif | |||
|
45 | </td> | |||
39 | </tr> |
|
46 | </tr> | |
40 | %else: |
|
47 | %else: | |
41 | ##forbid revoking permission from yourself, except if you're an super admin |
|
48 | ##forbid revoking permission from yourself, except if you're an super admin | |
@@ -52,6 +59,9 b'' | |||||
52 | ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span> |
|
59 | ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span> | |
53 | % else: |
|
60 | % else: | |
54 | ${h.link_to_user(_user.username)} |
|
61 | ${h.link_to_user(_user.username)} | |
|
62 | %if getattr(_user, 'duplicate_perm', None): | |||
|
63 | (${_('inactive duplicate')}) | |||
|
64 | %endif | |||
55 | % endif |
|
65 | % endif | |
56 | </span> |
|
66 | </span> | |
57 | </td> |
|
67 | </td> | |
@@ -63,8 +73,17 b'' | |||||
63 | </span> |
|
73 | </span> | |
64 | %endif |
|
74 | %endif | |
65 | </td> |
|
75 | </td> | |
|
76 | <td> | |||
|
77 | % if c.rhodecode_user.is_admin: | |||
|
78 | % if _user.username == h.DEFAULT_USER: | |||
|
79 | ${h.link_to('show permissions', h.route_path('admin_permissions_overview', _anchor='repositories-permissions'))} | |||
66 | %else: |
|
80 | % else: | |
67 | ## special case for current user permissions, we make sure he cannot take his own permissions |
|
81 | ${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))} | |
|
82 | % endif | |||
|
83 | % endif | |||
|
84 | </td> | |||
|
85 | %else: | |||
|
86 | ## special case for currently logged-in user permissions, we make sure he cannot take his own permissions | |||
68 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.none', disabled="disabled")}</td> |
|
87 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.none', disabled="disabled")}</td> | |
69 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.read', disabled="disabled")}</td> |
|
88 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.read', disabled="disabled")}</td> | |
70 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.write', disabled="disabled")}</td> |
|
89 | <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.write', disabled="disabled")}</td> | |
@@ -76,11 +95,19 b'' | |||||
76 | ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span> |
|
95 | ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span> | |
77 | % else: |
|
96 | % else: | |
78 | ${h.link_to_user(_user.username)} |
|
97 | ${h.link_to_user(_user.username)} | |
|
98 | %if getattr(_user, 'duplicate_perm', None): | |||
|
99 | (${_('inactive duplicate')}) | |||
|
100 | %endif | |||
79 | % endif |
|
101 | % endif | |
80 | <span class="user-perm-help-text">(${_('delegated admin')})</span> |
|
102 | <span class="user-perm-help-text">(${_('delegated admin')})</span> | |
81 | </span> |
|
103 | </span> | |
82 | </td> |
|
104 | </td> | |
83 | <td></td> |
|
105 | <td></td> | |
|
106 | <td> | |||
|
107 | % if c.rhodecode_user.is_admin: | |||
|
108 | ${h.link_to('show permissions', h.route_path('edit_user_perms_summary', user_id=_user.user_id, _anchor='repositories-permissions'))} | |||
|
109 | % endif | |||
|
110 | </td> | |||
84 | %endif |
|
111 | %endif | |
85 | </tr> |
|
112 | </tr> | |
86 | %endif |
|
113 | %endif | |
@@ -109,6 +136,11 b'' | |||||
109 | ${_('Revoke')} |
|
136 | ${_('Revoke')} | |
110 | </span> |
|
137 | </span> | |
111 | </td> |
|
138 | </td> | |
|
139 | <td> | |||
|
140 | % if c.rhodecode_user.is_admin: | |||
|
141 | ${h.link_to('show permissions', h.route_path('edit_user_group_perms_summary', user_group_id=_user_group.users_group_id, _anchor='repositories-permissions'))} | |||
|
142 | % endif | |||
|
143 | </td> | |||
112 | </tr> |
|
144 | </tr> | |
113 | %endfor |
|
145 | %endfor | |
114 | <tr class="new_members" id="add_perm_input"></tr> |
|
146 | <tr class="new_members" id="add_perm_input"></tr> | |
@@ -123,6 +155,7 b'' | |||||
123 | ${_('Add user/user group')} |
|
155 | ${_('Add user/user group')} | |
124 | </span> |
|
156 | </span> | |
125 | </td> |
|
157 | </td> | |
|
158 | <td></td> | |||
126 | </tr> |
|
159 | </tr> | |
127 | </table> |
|
160 | </table> | |
128 |
|
161 |
General Comments 0
You need to be logged in to leave comments.
Login now