##// END OF EJS Templates
"Users groups" is grammatically incorrect English - rename to "user groups"...
Mads Kiilerich -
r3410:5f1850e4 beta
parent child Browse files
Show More
@@ -75,7 +75,7 b' RhodeCode Features'
75 - Supports http/https, LDAP, AD, proxy-pass authentication.
75 - Supports http/https, LDAP, AD, proxy-pass authentication.
76 - Full permissions (private/read/write/admin) together with IP restrictions for each repository,
76 - Full permissions (private/read/write/admin) together with IP restrictions for each repository,
77 additional explicit forking and repository creation permissions.
77 additional explicit forking and repository creation permissions.
78 - Users groups for easier permission management
78 - User groups for easier permission management
79 - Repository groups let you group repos and manage them easier.
79 - Repository groups let you group repos and manage them easier.
80 - Users can fork other users repos, and compare them at any time.
80 - Users can fork other users repos, and compare them at any time.
81 - Integrates easily with other systems, with custom created mappers you can connect it to almost
81 - Integrates easily with other systems, with custom created mappers you can connect it to almost
@@ -436,7 +436,7 b' OUTPUT::'
436 get_users_group
436 get_users_group
437 ---------------
437 ---------------
438
438
439 Gets an existing users group. This command can be executed only using api_key
439 Gets an existing user group. This command can be executed only using api_key
440 belonging to user with admin rights.
440 belonging to user with admin rights.
441
441
442
442
@@ -446,7 +446,7 b' INPUT::'
446 api_key : "<api_key>"
446 api_key : "<api_key>"
447 method : "get_users_group"
447 method : "get_users_group"
448 args : {
448 args : {
449 "usersgroupid" : "<users group id or name>"
449 "usersgroupid" : "<user group id or name>"
450 }
450 }
451
451
452 OUTPUT::
452 OUTPUT::
@@ -479,7 +479,7 b' OUTPUT::'
479 get_users_groups
479 get_users_groups
480 ----------------
480 ----------------
481
481
482 Lists all existing users groups. This command can be executed only using
482 Lists all existing user groups. This command can be executed only using
483 api_key belonging to user with admin rights.
483 api_key belonging to user with admin rights.
484
484
485
485
@@ -507,7 +507,7 b' OUTPUT::'
507 create_users_group
507 create_users_group
508 ------------------
508 ------------------
509
509
510 Creates new users group. This command can be executed only using api_key
510 Creates new user group. This command can be executed only using api_key
511 belonging to user with admin rights
511 belonging to user with admin rights
512
512
513
513
@@ -525,7 +525,7 b' OUTPUT::'
525
525
526 id : <id_given_in_input>
526 id : <id_given_in_input>
527 result: {
527 result: {
528 "msg": "created new users group `<groupname>`",
528 "msg": "created new user group `<groupname>`",
529 "users_group": {
529 "users_group": {
530 "users_group_id" : "<id>",
530 "users_group_id" : "<id>",
531 "group_name" : "<groupname>",
531 "group_name" : "<groupname>",
@@ -538,7 +538,7 b' OUTPUT::'
538 add_user_to_users_group
538 add_user_to_users_group
539 -----------------------
539 -----------------------
540
540
541 Adds a user to a users group. If user exists in that group success will be
541 Adds a user to a user group. If user exists in that group success will be
542 `false`. This command can be executed only using api_key
542 `false`. This command can be executed only using api_key
543 belonging to user with admin rights
543 belonging to user with admin rights
544
544
@@ -549,7 +549,7 b' INPUT::'
549 api_key : "<api_key>"
549 api_key : "<api_key>"
550 method : "add_user_users_group"
550 method : "add_user_users_group"
551 args: {
551 args: {
552 "usersgroupid" : "<users group id or name>",
552 "usersgroupid" : "<user group id or name>",
553 "userid" : "<user_id or username>",
553 "userid" : "<user_id or username>",
554 }
554 }
555
555
@@ -558,7 +558,7 b' OUTPUT::'
558 id : <id_given_in_input>
558 id : <id_given_in_input>
559 result: {
559 result: {
560 "success": True|False # depends on if member is in group
560 "success": True|False # depends on if member is in group
561 "msg": "added member `<username>` to users group `<groupname>` |
561 "msg": "added member `<username>` to user group `<groupname>` |
562 User is already in that group"
562 User is already in that group"
563 }
563 }
564 error: null
564 error: null
@@ -567,7 +567,7 b' OUTPUT::'
567 remove_user_from_users_group
567 remove_user_from_users_group
568 ----------------------------
568 ----------------------------
569
569
570 Removes a user from a users group. If user is not in given group success will
570 Removes a user from a user group. If user is not in given group success will
571 be `false`. This command can be executed only
571 be `false`. This command can be executed only
572 using api_key belonging to user with admin rights
572 using api_key belonging to user with admin rights
573
573
@@ -578,7 +578,7 b' INPUT::'
578 api_key : "<api_key>"
578 api_key : "<api_key>"
579 method : "remove_user_from_users_group"
579 method : "remove_user_from_users_group"
580 args: {
580 args: {
581 "usersgroupid" : "<users group id or name>",
581 "usersgroupid" : "<user group id or name>",
582 "userid" : "<user_id or username>",
582 "userid" : "<user_id or username>",
583 }
583 }
584
584
@@ -587,7 +587,7 b' OUTPUT::'
587 id : <id_given_in_input>
587 id : <id_given_in_input>
588 result: {
588 result: {
589 "success": True|False, # depends on if member is in group
589 "success": True|False, # depends on if member is in group
590 "msg": "removed member <username> from users group <groupname> |
590 "msg": "removed member <username> from user group <groupname> |
591 User wasn't in group"
591 User wasn't in group"
592 }
592 }
593 error: null
593 error: null
@@ -929,7 +929,7 b' OUTPUT::'
929 grant_users_group_permission
929 grant_users_group_permission
930 ----------------------------
930 ----------------------------
931
931
932 Grant permission for users group on given repository, or update
932 Grant permission for user group on given repository, or update
933 existing one if found. This command can be executed only using
933 existing one if found. This command can be executed only using
934 api_key belonging to user with admin rights.
934 api_key belonging to user with admin rights.
935
935
@@ -941,7 +941,7 b' INPUT::'
941 method : "grant_users_group_permission"
941 method : "grant_users_group_permission"
942 args: {
942 args: {
943 "repoid" : "<reponame or repo_id>"
943 "repoid" : "<reponame or repo_id>"
944 "usersgroupid" : "<users group id or name>"
944 "usersgroupid" : "<user group id or name>"
945 "perm" : "(repository.(none|read|write|admin))",
945 "perm" : "(repository.(none|read|write|admin))",
946 }
946 }
947
947
@@ -958,7 +958,7 b' OUTPUT::'
958 revoke_users_group_permission
958 revoke_users_group_permission
959 -----------------------------
959 -----------------------------
960
960
961 Revoke permission for users group on given repository.This command can be
961 Revoke permission for user group on given repository.This command can be
962 executed only using api_key belonging to user with admin rights.
962 executed only using api_key belonging to user with admin rights.
963
963
964 INPUT::
964 INPUT::
@@ -968,7 +968,7 b' INPUT::'
968 method : "revoke_users_group_permission"
968 method : "revoke_users_group_permission"
969 args: {
969 args: {
970 "repoid" : "<reponame or repo_id>"
970 "repoid" : "<reponame or repo_id>"
971 "usersgroupid" : "<users group id or name>"
971 "usersgroupid" : "<user group id or name>"
972 }
972 }
973
973
974 OUTPUT::
974 OUTPUT::
@@ -196,7 +196,7 b' news'
196 fixes
196 fixes
197 +++++
197 +++++
198
198
199 - fixed #570 explicit users group permissions can overwrite owner permissions
199 - fixed #570 explicit user group permissions can overwrite owner permissions
200 - fixed #578 set proper PATH with current Python for Git
200 - fixed #578 set proper PATH with current Python for Git
201 hooks to execute within same Python as RhodeCode
201 hooks to execute within same Python as RhodeCode
202 - fixed issue with Git bare repos that ends with .git in name
202 - fixed issue with Git bare repos that ends with .git in name
@@ -385,7 +385,7 b' news'
385 - created rcextensions module with additional mappings (ref #322) and
385 - created rcextensions module with additional mappings (ref #322) and
386 post push/pull/create repo hooks callbacks
386 post push/pull/create repo hooks callbacks
387 - implemented #377 Users view for his own permissions on account page
387 - implemented #377 Users view for his own permissions on account page
388 - #399 added inheritance of permissions for users group on repos groups
388 - #399 added inheritance of permissions for user group on repos groups
389 - #401 repository group is automatically pre-selected when adding repos
389 - #401 repository group is automatically pre-selected when adding repos
390 inside a repository group
390 inside a repository group
391 - added alternative HTTP 403 response when client failed to authenticate. Helps
391 - added alternative HTTP 403 response when client failed to authenticate. Helps
@@ -654,7 +654,7 b' news'
654 - implemented #93 customizable changelog on combined revision ranges -
654 - implemented #93 customizable changelog on combined revision ranges -
655 equivalent of githubs compare view
655 equivalent of githubs compare view
656 - implemented #108 extended and more powerful LDAP configuration
656 - implemented #108 extended and more powerful LDAP configuration
657 - implemented #56 users groups
657 - implemented #56 user groups
658 - major code rewrites optimized codes for speed and memory usage
658 - major code rewrites optimized codes for speed and memory usage
659 - raw and diff downloads are now in git format
659 - raw and diff downloads are now in git format
660 - setup command checks for write access to given path
660 - setup command checks for write access to given path
@@ -235,7 +235,7 b' def make_map(config):'
235 m.connect("user_ips_delete", "/users_ips/{id}",
235 m.connect("user_ips_delete", "/users_ips/{id}",
236 action="delete_ip", conditions=dict(method=["DELETE"]))
236 action="delete_ip", conditions=dict(method=["DELETE"]))
237
237
238 #ADMIN USERS GROUPS REST ROUTES
238 #ADMIN USER GROUPS REST ROUTES
239 with rmap.submapper(path_prefix=ADMIN_PREFIX,
239 with rmap.submapper(path_prefix=ADMIN_PREFIX,
240 controller='admin/users_groups') as m:
240 controller='admin/users_groups') as m:
241 m.connect("users_groups", "/users_groups",
241 m.connect("users_groups", "/users_groups",
@@ -345,7 +345,7 b' class ReposController(BaseRepoController'
345 @HasRepoPermissionAllDecorator('repository.admin')
345 @HasRepoPermissionAllDecorator('repository.admin')
346 def delete_perm_users_group(self, repo_name):
346 def delete_perm_users_group(self, repo_name):
347 """
347 """
348 DELETE an existing repository permission users group
348 DELETE an existing repository permission user group
349
349
350 :param repo_name:
350 :param repo_name:
351 """
351 """
@@ -358,7 +358,7 b' class ReposController(BaseRepoController'
358 except Exception:
358 except Exception:
359 log.error(traceback.format_exc())
359 log.error(traceback.format_exc())
360 h.flash(_('An error occurred during deletion of repository'
360 h.flash(_('An error occurred during deletion of repository'
361 ' users groups'),
361 ' user groups'),
362 category='error')
362 category='error')
363 raise HTTPInternalServerError()
363 raise HTTPInternalServerError()
364
364
@@ -3,7 +3,7 b''
3 rhodecode.controllers.admin.repos_groups
3 rhodecode.controllers.admin.repos_groups
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
5
6 Repositories groups controller for RhodeCode
6 Repository groups controller for RhodeCode
7
7
8 :created_on: Mar 23, 2010
8 :created_on: Mar 23, 2010
9 :author: marcink
9 :author: marcink
@@ -282,7 +282,7 b' class ReposGroupsController(BaseControll'
282 @HasReposGroupPermissionAnyDecorator('group.admin')
282 @HasReposGroupPermissionAnyDecorator('group.admin')
283 def delete_repos_group_user_perm(self, group_name):
283 def delete_repos_group_user_perm(self, group_name):
284 """
284 """
285 DELETE an existing repositories group permission user
285 DELETE an existing repository group permission user
286
286
287 :param group_name:
287 :param group_name:
288 """
288 """
@@ -307,7 +307,7 b' class ReposGroupsController(BaseControll'
307 @HasReposGroupPermissionAnyDecorator('group.admin')
307 @HasReposGroupPermissionAnyDecorator('group.admin')
308 def delete_repos_group_users_group_perm(self, group_name):
308 def delete_repos_group_users_group_perm(self, group_name):
309 """
309 """
310 DELETE an existing repositories group permission users group
310 DELETE an existing repository group permission user group
311
311
312 :param group_name:
312 :param group_name:
313 """
313 """
@@ -322,7 +322,7 b' class ReposGroupsController(BaseControll'
322 except Exception:
322 except Exception:
323 log.error(traceback.format_exc())
323 log.error(traceback.format_exc())
324 h.flash(_('An error occurred during deletion of group'
324 h.flash(_('An error occurred during deletion of group'
325 ' users groups'),
325 ' user groups'),
326 category='error')
326 category='error')
327 raise HTTPInternalServerError()
327 raise HTTPInternalServerError()
328
328
@@ -3,7 +3,7 b''
3 rhodecode.controllers.admin.users_groups
3 rhodecode.controllers.admin.users_groups
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
5
6 Users Groups crud controller for pylons
6 User Groups crud controller for pylons
7
7
8 :created_on: Jan 25, 2011
8 :created_on: Jan 25, 2011
9 :author: marcink
9 :author: marcink
@@ -83,7 +83,7 b' class UsersGroupsController(BaseControll'
83 action_logger(self.rhodecode_user,
83 action_logger(self.rhodecode_user,
84 'admin_created_users_group:%s' % gr,
84 'admin_created_users_group:%s' % gr,
85 None, self.ip_addr, self.sa)
85 None, self.ip_addr, self.sa)
86 h.flash(_('created users group %s') % gr, category='success')
86 h.flash(_('created user group %s') % gr, category='success')
87 Session().commit()
87 Session().commit()
88 except formencode.Invalid, errors:
88 except formencode.Invalid, errors:
89 return htmlfill.render(
89 return htmlfill.render(
@@ -94,7 +94,7 b' class UsersGroupsController(BaseControll'
94 encoding="UTF-8")
94 encoding="UTF-8")
95 except Exception:
95 except Exception:
96 log.error(traceback.format_exc())
96 log.error(traceback.format_exc())
97 h.flash(_('error occurred during creation of users group %s') \
97 h.flash(_('error occurred during creation of user group %s') \
98 % request.POST.get('users_group_name'), category='error')
98 % request.POST.get('users_group_name'), category='error')
99
99
100 return redirect(url('users_groups'))
100 return redirect(url('users_groups'))
@@ -161,7 +161,7 b' class UsersGroupsController(BaseControll'
161 action_logger(self.rhodecode_user,
161 action_logger(self.rhodecode_user,
162 'admin_updated_users_group:%s' % gr,
162 'admin_updated_users_group:%s' % gr,
163 None, self.ip_addr, self.sa)
163 None, self.ip_addr, self.sa)
164 h.flash(_('updated users group %s') % gr, category='success')
164 h.flash(_('updated user group %s') % gr, category='success')
165 Session().commit()
165 Session().commit()
166 except formencode.Invalid, errors:
166 except formencode.Invalid, errors:
167 ug_model = UsersGroupModel()
167 ug_model = UsersGroupModel()
@@ -183,7 +183,7 b' class UsersGroupsController(BaseControll'
183 encoding="UTF-8")
183 encoding="UTF-8")
184 except Exception:
184 except Exception:
185 log.error(traceback.format_exc())
185 log.error(traceback.format_exc())
186 h.flash(_('error occurred during update of users group %s') \
186 h.flash(_('error occurred during update of user group %s') \
187 % request.POST.get('users_group_name'), category='error')
187 % request.POST.get('users_group_name'), category='error')
188
188
189 return redirect(url('edit_users_group', id=id))
189 return redirect(url('edit_users_group', id=id))
@@ -200,12 +200,12 b' class UsersGroupsController(BaseControll'
200 try:
200 try:
201 UsersGroupModel().delete(usr_gr)
201 UsersGroupModel().delete(usr_gr)
202 Session().commit()
202 Session().commit()
203 h.flash(_('successfully deleted users group'), category='success')
203 h.flash(_('successfully deleted user group'), category='success')
204 except UsersGroupsAssignedException, e:
204 except UsersGroupsAssignedException, e:
205 h.flash(e, category='error')
205 h.flash(e, category='error')
206 except Exception:
206 except Exception:
207 log.error(traceback.format_exc())
207 log.error(traceback.format_exc())
208 h.flash(_('An error occurred during deletion of users group'),
208 h.flash(_('An error occurred during deletion of user group'),
209 category='error')
209 category='error')
210 return redirect(url('users_groups'))
210 return redirect(url('users_groups'))
211
211
@@ -254,23 +254,23 b' class UsersGroupsController(BaseControll'
254 if grant_create_perm:
254 if grant_create_perm:
255 usersgroup_model.revoke_perm(id, 'hg.create.none')
255 usersgroup_model.revoke_perm(id, 'hg.create.none')
256 usersgroup_model.grant_perm(id, 'hg.create.repository')
256 usersgroup_model.grant_perm(id, 'hg.create.repository')
257 h.flash(_("Granted 'repository create' permission to users group"),
257 h.flash(_("Granted 'repository create' permission to user group"),
258 category='success')
258 category='success')
259 else:
259 else:
260 usersgroup_model.revoke_perm(id, 'hg.create.repository')
260 usersgroup_model.revoke_perm(id, 'hg.create.repository')
261 usersgroup_model.grant_perm(id, 'hg.create.none')
261 usersgroup_model.grant_perm(id, 'hg.create.none')
262 h.flash(_("Revoked 'repository create' permission to users group"),
262 h.flash(_("Revoked 'repository create' permission to user group"),
263 category='success')
263 category='success')
264
264
265 if grant_fork_perm:
265 if grant_fork_perm:
266 usersgroup_model.revoke_perm(id, 'hg.fork.none')
266 usersgroup_model.revoke_perm(id, 'hg.fork.none')
267 usersgroup_model.grant_perm(id, 'hg.fork.repository')
267 usersgroup_model.grant_perm(id, 'hg.fork.repository')
268 h.flash(_("Granted 'repository fork' permission to users group"),
268 h.flash(_("Granted 'repository fork' permission to user group"),
269 category='success')
269 category='success')
270 else:
270 else:
271 usersgroup_model.revoke_perm(id, 'hg.fork.repository')
271 usersgroup_model.revoke_perm(id, 'hg.fork.repository')
272 usersgroup_model.grant_perm(id, 'hg.fork.none')
272 usersgroup_model.grant_perm(id, 'hg.fork.none')
273 h.flash(_("Revoked 'repository fork' permission to users group"),
273 h.flash(_("Revoked 'repository fork' permission to user group"),
274 category='success')
274 category='success')
275
275
276 Session().commit()
276 Session().commit()
@@ -121,13 +121,13 b' def get_repo_or_error(repoid):'
121
121
122 def get_users_group_or_error(usersgroupid):
122 def get_users_group_or_error(usersgroupid):
123 """
123 """
124 Get users group by id or name or return JsonRPCError if not found
124 Get user group by id or name or return JsonRPCError if not found
125
125
126 :param userid:
126 :param userid:
127 """
127 """
128 users_group = UsersGroupModel().get_group(usersgroupid)
128 users_group = UsersGroupModel().get_group(usersgroupid)
129 if users_group is None:
129 if users_group is None:
130 raise JSONRPCError('users group `%s` does not exist' % usersgroupid)
130 raise JSONRPCError('user group `%s` does not exist' % usersgroupid)
131 return users_group
131 return users_group
132
132
133
133
@@ -449,7 +449,7 b' class ApiController(JSONRPCController):'
449 @HasPermissionAllDecorator('hg.admin')
449 @HasPermissionAllDecorator('hg.admin')
450 def get_users_group(self, apiuser, usersgroupid):
450 def get_users_group(self, apiuser, usersgroupid):
451 """"
451 """"
452 Get users group by name or id
452 Get user group by name or id
453
453
454 :param apiuser:
454 :param apiuser:
455 :param usersgroupid:
455 :param usersgroupid:
@@ -468,7 +468,7 b' class ApiController(JSONRPCController):'
468 @HasPermissionAllDecorator('hg.admin')
468 @HasPermissionAllDecorator('hg.admin')
469 def get_users_groups(self, apiuser):
469 def get_users_groups(self, apiuser):
470 """"
470 """"
471 Get all users groups
471 Get all user groups
472
472
473 :param apiuser:
473 :param apiuser:
474 """
474 """
@@ -489,14 +489,14 b' class ApiController(JSONRPCController):'
489 """
489 """
490
490
491 if UsersGroupModel().get_by_name(group_name):
491 if UsersGroupModel().get_by_name(group_name):
492 raise JSONRPCError("users group `%s` already exist" % group_name)
492 raise JSONRPCError("user group `%s` already exist" % group_name)
493
493
494 try:
494 try:
495 active = Optional.extract(active)
495 active = Optional.extract(active)
496 ug = UsersGroupModel().create(name=group_name, active=active)
496 ug = UsersGroupModel().create(name=group_name, active=active)
497 Session().commit()
497 Session().commit()
498 return dict(
498 return dict(
499 msg='created new users group `%s`' % group_name,
499 msg='created new user group `%s`' % group_name,
500 users_group=ug.get_api_data()
500 users_group=ug.get_api_data()
501 )
501 )
502 except Exception:
502 except Exception:
@@ -506,7 +506,7 b' class ApiController(JSONRPCController):'
506 @HasPermissionAllDecorator('hg.admin')
506 @HasPermissionAllDecorator('hg.admin')
507 def add_user_to_users_group(self, apiuser, usersgroupid, userid):
507 def add_user_to_users_group(self, apiuser, usersgroupid, userid):
508 """"
508 """"
509 Add a user to a users group
509 Add a user to a user group
510
510
511 :param apiuser:
511 :param apiuser:
512 :param usersgroupid:
512 :param usersgroupid:
@@ -518,7 +518,7 b' class ApiController(JSONRPCController):'
518 try:
518 try:
519 ugm = UsersGroupModel().add_user_to_group(users_group, user)
519 ugm = UsersGroupModel().add_user_to_group(users_group, user)
520 success = True if ugm != True else False
520 success = True if ugm != True else False
521 msg = 'added member `%s` to users group `%s`' % (
521 msg = 'added member `%s` to user group `%s`' % (
522 user.username, users_group.users_group_name
522 user.username, users_group.users_group_name
523 )
523 )
524 msg = msg if success else 'User is already in that group'
524 msg = msg if success else 'User is already in that group'
@@ -531,7 +531,7 b' class ApiController(JSONRPCController):'
531 except Exception:
531 except Exception:
532 log.error(traceback.format_exc())
532 log.error(traceback.format_exc())
533 raise JSONRPCError(
533 raise JSONRPCError(
534 'failed to add member to users group `%s`' % (
534 'failed to add member to user group `%s`' % (
535 users_group.users_group_name
535 users_group.users_group_name
536 )
536 )
537 )
537 )
@@ -551,7 +551,7 b' class ApiController(JSONRPCController):'
551 try:
551 try:
552 success = UsersGroupModel().remove_user_from_group(users_group,
552 success = UsersGroupModel().remove_user_from_group(users_group,
553 user)
553 user)
554 msg = 'removed member `%s` from users group `%s`' % (
554 msg = 'removed member `%s` from user group `%s`' % (
555 user.username, users_group.users_group_name
555 user.username, users_group.users_group_name
556 )
556 )
557 msg = msg if success else "User wasn't in group"
557 msg = msg if success else "User wasn't in group"
@@ -560,7 +560,7 b' class ApiController(JSONRPCController):'
560 except Exception:
560 except Exception:
561 log.error(traceback.format_exc())
561 log.error(traceback.format_exc())
562 raise JSONRPCError(
562 raise JSONRPCError(
563 'failed to remove member from users group `%s`' % (
563 'failed to remove member from user group `%s`' % (
564 users_group.users_group_name
564 users_group.users_group_name
565 )
565 )
566 )
566 )
@@ -890,7 +890,7 b' class ApiController(JSONRPCController):'
890 def grant_users_group_permission(self, apiuser, repoid, usersgroupid,
890 def grant_users_group_permission(self, apiuser, repoid, usersgroupid,
891 perm):
891 perm):
892 """
892 """
893 Grant permission for users group on given repository, or update
893 Grant permission for user group on given repository, or update
894 existing one if found
894 existing one if found
895
895
896 :param apiuser:
896 :param apiuser:
@@ -909,7 +909,7 b' class ApiController(JSONRPCController):'
909
909
910 Session().commit()
910 Session().commit()
911 return dict(
911 return dict(
912 msg='Granted perm: `%s` for users group: `%s` in '
912 msg='Granted perm: `%s` for user group: `%s` in '
913 'repo: `%s`' % (
913 'repo: `%s`' % (
914 perm.permission_name, users_group.users_group_name,
914 perm.permission_name, users_group.users_group_name,
915 repo.repo_name
915 repo.repo_name
@@ -919,7 +919,7 b' class ApiController(JSONRPCController):'
919 except Exception:
919 except Exception:
920 log.error(traceback.format_exc())
920 log.error(traceback.format_exc())
921 raise JSONRPCError(
921 raise JSONRPCError(
922 'failed to edit permission for users group: `%s` in '
922 'failed to edit permission for user group: `%s` in '
923 'repo: `%s`' % (
923 'repo: `%s`' % (
924 usersgroupid, repo.repo_name
924 usersgroupid, repo.repo_name
925 )
925 )
@@ -928,7 +928,7 b' class ApiController(JSONRPCController):'
928 @HasPermissionAllDecorator('hg.admin')
928 @HasPermissionAllDecorator('hg.admin')
929 def revoke_users_group_permission(self, apiuser, repoid, usersgroupid):
929 def revoke_users_group_permission(self, apiuser, repoid, usersgroupid):
930 """
930 """
931 Revoke permission for users group on given repository
931 Revoke permission for user group on given repository
932
932
933 :param apiuser:
933 :param apiuser:
934 :param repoid:
934 :param repoid:
@@ -943,7 +943,7 b' class ApiController(JSONRPCController):'
943
943
944 Session().commit()
944 Session().commit()
945 return dict(
945 return dict(
946 msg='Revoked perm for users group: `%s` in repo: `%s`' % (
946 msg='Revoked perm for user group: `%s` in repo: `%s`' % (
947 users_group.users_group_name, repo.repo_name
947 users_group.users_group_name, repo.repo_name
948 ),
948 ),
949 success=True
949 success=True
@@ -951,7 +951,7 b' class ApiController(JSONRPCController):'
951 except Exception:
951 except Exception:
952 log.error(traceback.format_exc())
952 log.error(traceback.format_exc())
953 raise JSONRPCError(
953 raise JSONRPCError(
954 'failed to edit permission for users group: `%s` in '
954 'failed to edit permission for user group: `%s` in '
955 'repo: `%s`' % (
955 'repo: `%s`' % (
956 users_group.users_group_name, repo.repo_name
956 users_group.users_group_name, repo.repo_name
957 )
957 )
@@ -3,7 +3,7 b''
3 rhodecode.model.user_group
3 rhodecode.model.user_group
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~
5
5
6 users groups model for RhodeCode
6 repo group model for RhodeCode
7
7
8 :created_on: Jan 25, 2011
8 :created_on: Jan 25, 2011
9 :author: marcink
9 :author: marcink
@@ -218,7 +218,7 b' class ReposGroupModel(BaseModel):'
218 if member_type == 'user':
218 if member_type == 'user':
219 # this updates also current one if found
219 # this updates also current one if found
220 _set_perm_user(obj, user=member, perm=perm)
220 _set_perm_user(obj, user=member, perm=perm)
221 ## set for users group
221 ## set for user group
222 else:
222 else:
223 _set_perm_group(obj, users_group=member, perm=perm)
223 _set_perm_group(obj, users_group=member, perm=perm)
224 # set new permissions
224 # set new permissions
@@ -289,11 +289,11 b' class ReposGroupModel(BaseModel):'
289 def delete_permission(self, repos_group, obj, obj_type, recursive):
289 def delete_permission(self, repos_group, obj, obj_type, recursive):
290 """
290 """
291 Revokes permission for repos_group for given obj(user or users_group),
291 Revokes permission for repos_group for given obj(user or users_group),
292 obj_type can be user or users group
292 obj_type can be user or user group
293
293
294 :param repos_group:
294 :param repos_group:
295 :param obj: user or users group id
295 :param obj: user or user group id
296 :param obj_type: user or users group type
296 :param obj_type: user or user group type
297 :param recursive: recurse to all children of group
297 :param recursive: recurse to all children of group
298 """
298 """
299 from rhodecode.model.repo import RepoModel
299 from rhodecode.model.repo import RepoModel
@@ -376,13 +376,13 b' class ReposGroupModel(BaseModel):'
376
376
377 def grant_users_group_permission(self, repos_group, group_name, perm):
377 def grant_users_group_permission(self, repos_group, group_name, perm):
378 """
378 """
379 Grant permission for users group on given repositories group, or update
379 Grant permission for user group on given repositories group, or update
380 existing one if found
380 existing one if found
381
381
382 :param repos_group: Instance of ReposGroup, repositories_group_id,
382 :param repos_group: Instance of ReposGroup, repositories_group_id,
383 or repositories_group name
383 or repositories_group name
384 :param group_name: Instance of UserGroup, users_group_id,
384 :param group_name: Instance of UserGroup, users_group_id,
385 or users group name
385 or user group name
386 :param perm: Instance of Permission, or permission_name
386 :param perm: Instance of Permission, or permission_name
387 """
387 """
388 repos_group = self._get_repos_group(repos_group)
388 repos_group = self._get_repos_group(repos_group)
@@ -407,12 +407,12 b' class ReposGroupModel(BaseModel):'
407
407
408 def revoke_users_group_permission(self, repos_group, group_name):
408 def revoke_users_group_permission(self, repos_group, group_name):
409 """
409 """
410 Revoke permission for users group on given repositories group
410 Revoke permission for user group on given repositories group
411
411
412 :param repos_group: Instance of ReposGroup, repositories_group_id,
412 :param repos_group: Instance of ReposGroup, repositories_group_id,
413 or repositories_group name
413 or repositories_group name
414 :param group_name: Instance of UserGroup, users_group_id,
414 :param group_name: Instance of UserGroup, users_group_id,
415 or users group name
415 or user group name
416 """
416 """
417 repos_group = self._get_repos_group(repos_group)
417 repos_group = self._get_repos_group(repos_group)
418 group_name = self.__get_users_group(group_name)
418 group_name = self.__get_users_group(group_name)
@@ -464,7 +464,7 b' class UserModel(BaseModel):'
464 p = 'repository.admin'
464 p = 'repository.admin'
465 user.permissions[RK][r_k] = p
465 user.permissions[RK][r_k] = p
466
466
467 # repositories groups
467 # repository groups
468 for perm in default_repo_groups_perms:
468 for perm in default_repo_groups_perms:
469 rg_k = perm.UserRepoGroupToPerm.group.group_name
469 rg_k = perm.UserRepoGroupToPerm.group.group_name
470 p = 'group.admin'
470 p = 'group.admin'
@@ -497,7 +497,7 b' class UserModel(BaseModel):'
497
497
498 user.permissions[RK][r_k] = p
498 user.permissions[RK][r_k] = p
499
499
500 # defaults for repositories groups taken from default user permission
500 # defaults for repository groups taken from default user permission
501 # on given group
501 # on given group
502 for perm in default_repo_groups_perms:
502 for perm in default_repo_groups_perms:
503 rg_k = perm.UserRepoGroupToPerm.group.group_name
503 rg_k = perm.UserRepoGroupToPerm.group.group_name
@@ -610,7 +610,7 b' class UserModel(BaseModel):'
610 user.permissions[RK][r_k] = p
610 user.permissions[RK][r_k] = p
611
611
612 #======================================================================
612 #======================================================================
613 # !! PERMISSIONS FOR REPOSITORIES GROUPS !!
613 # !! PERMISSIONS FOR REPOSITORY GROUPS !!
614 #======================================================================
614 #======================================================================
615 #======================================================================
615 #======================================================================
616 # check if user is part of user groups for this repository groups and
616 # check if user is part of user groups for this repository groups and
@@ -3,7 +3,7 b''
3 rhodecode.model.users_group
3 rhodecode.model.users_group
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
5
6 users group model for RhodeCode
6 user group model for RhodeCode
7
7
8 :created_on: Oct 1, 2011
8 :created_on: Oct 1, 2011
9 :author: nvinot
9 :author: nvinot
@@ -38,7 +38,7 b''
38 %endif
38 %endif
39 %endfor
39 %endfor
40
40
41 ## USERS GROUPS
41 ## USER GROUPS
42 %for g2p in c.repo_info.users_group_to_perm:
42 %for g2p in c.repo_info.users_group_to_perm:
43 <tr id="id${id(g2p.users_group.users_group_name)}">
43 <tr id="id${id(g2p.users_group.users_group_name)}">
44 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.none')}</td>
44 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'repository.none')}</td>
@@ -109,7 +109,7 b' function ajaxActionUsersGroup(users_grou'
109 tr.parentNode.removeChild(tr);
109 tr.parentNode.removeChild(tr);
110 },
110 },
111 failure:function(o){
111 failure:function(o){
112 alert("${_('Failed to remove users group')}");
112 alert("${_('Failed to remove user group')}");
113 },
113 },
114 };
114 };
115 var postData = '_method=delete&users_group_id='+users_group_id;
115 var postData = '_method=delete&users_group_id='+users_group_id;
@@ -40,7 +40,7 b''
40 </tr>
40 </tr>
41 %endfor
41 %endfor
42
42
43 ## USERS GROUPS
43 ## USER GROUPS
44 %for g2p in c.repos_group.users_group_to_perm:
44 %for g2p in c.repos_group.users_group_to_perm:
45 <tr id="id${id(g2p.users_group.users_group_name)}">
45 <tr id="id${id(g2p.users_group.users_group_name)}">
46 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'group.none')}</td>
46 <td>${h.radio('g_perm_%s' % g2p.users_group.users_group_name,'group.none')}</td>
@@ -113,7 +113,7 b' function ajaxActionUsersGroup(users_grou'
113 tr.parentNode.removeChild(tr);
113 tr.parentNode.removeChild(tr);
114 },
114 },
115 failure:function(o){
115 failure:function(o){
116 alert("${_('Failed to remove users group')}");
116 alert("${_('Failed to remove user group')}");
117 },
117 },
118 };
118 };
119 var recursive = YUD.get('recursive').checked;
119 var recursive = YUD.get('recursive').checked;
@@ -2,7 +2,7 b''
2 <%inherit file="/base/base.html"/>
2 <%inherit file="/base/base.html"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 ${_('Repositories groups administration')} - ${c.rhodecode_name}
5 ${_('Repository groups administration')} - ${c.rhodecode_name}
6 </%def>
6 </%def>
7
7
8
8
@@ -48,7 +48,7 b''
48 <tr>
48 <tr>
49 <td>
49 <td>
50 <div style="white-space: nowrap">
50 <div style="white-space: nowrap">
51 <img class="icon" alt="${_('Repositories group')}" src="${h.url('/images/icons/database_link.png')}"/>
51 <img class="icon" alt="${_('Repository group')}" src="${h.url('/images/icons/database_link.png')}"/>
52 ${h.link_to(h.literal(' &raquo; '.join(map(h.safe_unicode,[g.name for g in gr.parents+[gr]]))), url('repos_group_home',group_name=gr.group_name))}
52 ${h.link_to(h.literal(' &raquo; '.join(map(h.safe_unicode,[g.name for g in gr.parents+[gr]]))), url('repos_group_home',group_name=gr.group_name))}
53 </div>
53 </div>
54 </td>
54 </td>
@@ -69,7 +69,7 b''
69
69
70 </table>
70 </table>
71 % else:
71 % else:
72 ${_('There are no repositories groups yet')}
72 ${_('There are no repository groups yet')}
73 % endif
73 % endif
74
74
75 </div>
75 </div>
@@ -2,14 +2,14 b''
2 <%inherit file="/base/base.html"/>
2 <%inherit file="/base/base.html"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 ${_('Add users group')} - ${c.rhodecode_name}
5 ${_('Add user group')} - ${c.rhodecode_name}
6 </%def>
6 </%def>
7 <%def name="breadcrumbs_links()">
7 <%def name="breadcrumbs_links()">
8 ${h.link_to(_('Admin'),h.url('admin_home'))}
8 ${h.link_to(_('Admin'),h.url('admin_home'))}
9 &raquo;
9 &raquo;
10 ${h.link_to(_('Users groups'),h.url('users_groups'))}
10 ${h.link_to(_('User groups'),h.url('users_groups'))}
11 &raquo;
11 &raquo;
12 ${_('add new users group')}
12 ${_('add new user group')}
13 </%def>
13 </%def>
14
14
15 <%def name="page_nav()">
15 <%def name="page_nav()">
@@ -2,13 +2,13 b''
2 <%inherit file="/base/base.html"/>
2 <%inherit file="/base/base.html"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 ${_('Users groups administration')} - ${c.rhodecode_name}
5 ${_('User groups administration')} - ${c.rhodecode_name}
6 </%def>
6 </%def>
7
7
8 <%def name="breadcrumbs_links()">
8 <%def name="breadcrumbs_links()">
9 ${h.link_to(_('Admin'),h.url('admin_home'))}
9 ${h.link_to(_('Admin'),h.url('admin_home'))}
10 &raquo;
10 &raquo;
11 ${_('users groups')}
11 ${_('user groups')}
12 </%def>
12 </%def>
13
13
14 <%def name="page_nav()">
14 <%def name="page_nav()">
@@ -44,7 +44,7 b''
44 <td>
44 <td>
45 ${h.form(url('users_group', id=u_group.users_group_id),method='delete')}
45 ${h.form(url('users_group', id=u_group.users_group_id),method='delete')}
46 ${h.submit('remove_',_('delete'),id="remove_group_%s" % u_group.users_group_id,
46 ${h.submit('remove_',_('delete'),id="remove_group_%s" % u_group.users_group_id,
47 class_="delete_icon action_button",onclick="return confirm('"+_('Confirm to delete this users group: %s') % u_group.users_group_name+"');")}
47 class_="delete_icon action_button",onclick="return confirm('"+_('Confirm to delete this user group: %s') % u_group.users_group_name+"');")}
48 ${h.end_form()}
48 ${h.end_form()}
49 </td>
49 </td>
50 </tr>
50 </tr>
@@ -240,9 +240,9 b''
240 <ul>
240 <ul>
241 <li>${h.link_to(_('admin journal'),h.url('admin_home'),class_='journal')}</li>
241 <li>${h.link_to(_('admin journal'),h.url('admin_home'),class_='journal')}</li>
242 <li>${h.link_to(_('repositories'),h.url('repos'),class_='repos')}</li>
242 <li>${h.link_to(_('repositories'),h.url('repos'),class_='repos')}</li>
243 <li>${h.link_to(_('repositories groups'),h.url('repos_groups'),class_='repos_groups')}</li>
243 <li>${h.link_to(_('repository groups'),h.url('repos_groups'),class_='repos_groups')}</li>
244 <li>${h.link_to(_('users'),h.url('users'),class_='users')}</li>
244 <li>${h.link_to(_('users'),h.url('users'),class_='users')}</li>
245 <li>${h.link_to(_('users groups'),h.url('users_groups'),class_='groups')}</li>
245 <li>${h.link_to(_('user groups'),h.url('users_groups'),class_='groups')}</li>
246 <li>${h.link_to(_('permissions'),h.url('edit_permission',id='default'),class_='permissions')}</li>
246 <li>${h.link_to(_('permissions'),h.url('edit_permission',id='default'),class_='permissions')}</li>
247 <li>${h.link_to(_('ldap'),h.url('ldap_home'),class_='ldap')}</li>
247 <li>${h.link_to(_('ldap'),h.url('ldap_home'),class_='ldap')}</li>
248 <li>${h.link_to(_('defaults'),h.url('defaults'),class_='defaults')}</li>
248 <li>${h.link_to(_('defaults'),h.url('defaults'),class_='defaults')}</li>
@@ -258,7 +258,7 b''
258 ${h.link_to(_('admin'),h.url('admin_home'),class_='admin')}
258 ${h.link_to(_('admin'),h.url('admin_home'),class_='admin')}
259 <%def name="admin_menu_simple()">
259 <%def name="admin_menu_simple()">
260 <ul>
260 <ul>
261 <li>${h.link_to(_('repositories groups'),h.url('repos_groups'),class_='repos_groups')}</li>
261 <li>${h.link_to(_('repository groups'),h.url('repos_groups'),class_='repos_groups')}</li>
262 </ul>
262 </ul>
263 </%def>
263 </%def>
264 ## ADMIN MENU
264 ## ADMIN MENU
@@ -6,7 +6,7 b' class TestReposGroupsController(TestCont'
6 def test_index(self):
6 def test_index(self):
7 self.log_user()
7 self.log_user()
8 response = self.app.get(url('repos_groups'))
8 response = self.app.get(url('repos_groups'))
9 response.mustcontain('There are no repositories groups yet')
9 response.mustcontain('There are no repository groups yet')
10
10
11 # def test_index_as_xml(self):
11 # def test_index_as_xml(self):
12 # response = self.app.get(url('formatted_repos_groups', format='xml'))
12 # response = self.app.get(url('formatted_repos_groups', format='xml'))
General Comments 0
You need to be logged in to leave comments. Login now