##// END OF EJS Templates
fixed overwrite default user group permission flag
marcink -
r3735:8a40028e beta
parent child Browse files
Show More
@@ -319,6 +319,7 b' def DefaultPermissionsForm(repo_perms_ch'
319 filter_extra_fields = True
319 filter_extra_fields = True
320 overwrite_default_repo = v.StringBoolean(if_missing=False)
320 overwrite_default_repo = v.StringBoolean(if_missing=False)
321 overwrite_default_group = v.StringBoolean(if_missing=False)
321 overwrite_default_group = v.StringBoolean(if_missing=False)
322 overwrite_default_user_group = v.StringBoolean(if_missing=False)
322 anonymous = v.StringBoolean(if_missing=False)
323 anonymous = v.StringBoolean(if_missing=False)
323 default_repo_perm = v.OneOf(repo_perms_choices)
324 default_repo_perm = v.OneOf(repo_perms_choices)
324 default_group_perm = v.OneOf(group_perms_choices)
325 default_group_perm = v.OneOf(group_perms_choices)
@@ -30,7 +30,7 b' from sqlalchemy.exc import DatabaseError'
30
30
31 from rhodecode.model import BaseModel
31 from rhodecode.model import BaseModel
32 from rhodecode.model.db import User, Permission, UserToPerm, UserRepoToPerm,\
32 from rhodecode.model.db import User, Permission, UserToPerm, UserRepoToPerm,\
33 UserRepoGroupToPerm
33 UserRepoGroupToPerm, UserUserGroupToPerm
34 from rhodecode.lib.utils2 import str2bool
34 from rhodecode.lib.utils2 import str2bool
35
35
36 log = logging.getLogger(__name__)
36 log = logging.getLogger(__name__)
@@ -145,6 +145,16 b' class PermissionModel(BaseModel):'
145 g2p.permission = _def
145 g2p.permission = _def
146 self.sa.add(g2p)
146 self.sa.add(g2p)
147
147
148 if form_result['overwrite_default_user_group'] == True:
149 _def_name = form_result['default_user_group_perm'].split('usergroup.')[-1]
150 # groups
151 _def = Permission.get_by_key('usergroup.' + _def_name)
152 for g2p in self.sa.query(UserUserGroupToPerm)\
153 .filter(UserUserGroupToPerm.user == perm_user)\
154 .all():
155 g2p.permission = _def
156 self.sa.add(g2p)
157
148 self.sa.commit()
158 self.sa.commit()
149 except (DatabaseError,):
159 except (DatabaseError,):
150 log.error(traceback.format_exc())
160 log.error(traceback.format_exc())
General Comments 0
You need to be logged in to leave comments. Login now