Show More
@@ -75,6 +75,11 b' class PermissionsController(BaseControll' | |||||
75 | ('hg.register.auto_activate', |
|
75 | ('hg.register.auto_activate', | |
76 | _('Allowed with automatic account activation')), ] |
|
76 | _('Allowed with automatic account activation')), ] | |
77 |
|
77 | |||
|
78 | c.extern_activate_choices = [ | |||
|
79 | ('hg.extern_activate.manual', _('Manual activation of external account')), | |||
|
80 | ('hg.extern_activate.auto', _('Automatic activation of external account')), | |||
|
81 | ] | |||
|
82 | ||||
78 | c.repo_create_choices = [('hg.create.none', _('Disabled')), |
|
83 | c.repo_create_choices = [('hg.create.none', _('Disabled')), | |
79 | ('hg.create.repository', _('Enabled'))] |
|
84 | ('hg.create.repository', _('Enabled'))] | |
80 |
|
85 | |||
@@ -121,7 +126,9 b' class PermissionsController(BaseControll' | |||||
121 | [x[0] for x in c.repo_group_create_choices], |
|
126 | [x[0] for x in c.repo_group_create_choices], | |
122 | [x[0] for x in c.user_group_create_choices], |
|
127 | [x[0] for x in c.user_group_create_choices], | |
123 | [x[0] for x in c.fork_choices], |
|
128 | [x[0] for x in c.fork_choices], | |
124 |
[x[0] for x in c.register_choices] |
|
129 | [x[0] for x in c.register_choices], | |
|
130 | [x[0] for x in c.extern_activate_choices], | |||
|
131 | )() | |||
125 |
|
132 | |||
126 | try: |
|
133 | try: | |
127 | form_result = _form.to_python(dict(request.POST)) |
|
134 | form_result = _form.to_python(dict(request.POST)) | |
@@ -194,6 +201,9 b' class PermissionsController(BaseControll' | |||||
194 | if p.permission.permission_name.startswith('hg.register.'): |
|
201 | if p.permission.permission_name.startswith('hg.register.'): | |
195 | defaults['default_register'] = p.permission.permission_name |
|
202 | defaults['default_register'] = p.permission.permission_name | |
196 |
|
203 | |||
|
204 | if p.permission.permission_name.startswith('hg.extern_activate.'): | |||
|
205 | defaults['default_extern_activate'] = p.permission.permission_name | |||
|
206 | ||||
197 | if p.permission.permission_name.startswith('hg.fork.'): |
|
207 | if p.permission.permission_name.startswith('hg.fork.'): | |
198 | defaults['default_fork'] = p.permission.permission_name |
|
208 | defaults['default_fork'] = p.permission.permission_name | |
199 |
|
209 |
@@ -228,8 +228,8 b' def authenticate(username, password):' | |||||
228 | 'name': safe_unicode(get_ldap_attr('ldap_attr_firstname')), |
|
228 | 'name': safe_unicode(get_ldap_attr('ldap_attr_firstname')), | |
229 | 'lastname': safe_unicode(get_ldap_attr('ldap_attr_lastname')), |
|
229 | 'lastname': safe_unicode(get_ldap_attr('ldap_attr_lastname')), | |
230 | 'email': get_ldap_attr('ldap_attr_email'), |
|
230 | 'email': get_ldap_attr('ldap_attr_email'), | |
231 |
'active': 'hg. |
|
231 | 'active': 'hg.extern_activate.auto' in User.get_default_user()\ | |
232 |
|
|
232 | .AuthUser.permissions['global'] | |
233 | } |
|
233 | } | |
234 |
|
234 | |||
235 | # don't store LDAP password since we don't need it. Override |
|
235 | # don't store LDAP password since we don't need it. Override | |
@@ -258,8 +258,8 b' def login_container_auth(username):' | |||||
258 | 'name': username, |
|
258 | 'name': username, | |
259 | 'lastname': None, |
|
259 | 'lastname': None, | |
260 | 'email': None, |
|
260 | 'email': None, | |
261 |
'active': 'hg. |
|
261 | 'active': 'hg.extern_activate.auto' in User.get_default_user()\ | |
262 |
|
|
262 | .AuthUser.permissions['global'] | |
263 | } |
|
263 | } | |
264 | user = UserModel().create_for_container_auth(username, user_attrs) |
|
264 | user = UserModel().create_for_container_auth(username, user_attrs) | |
265 | if not user: |
|
265 | if not user: |
@@ -1424,12 +1424,13 b' class Permission(Base, BaseModel):' | |||||
1424 | ('hg.fork.none', _('Repository forking disabled')), |
|
1424 | ('hg.fork.none', _('Repository forking disabled')), | |
1425 | ('hg.fork.repository', _('Repository forking enabled')), |
|
1425 | ('hg.fork.repository', _('Repository forking enabled')), | |
1426 |
|
1426 | |||
1427 |
('hg.register.none', _('Regist |
|
1427 | ('hg.register.none', _('Registration disabled')), | |
1428 |
('hg.register.manual_activate', _('Regist |
|
1428 | ('hg.register.manual_activate', _('User Registration with manual account activation')), | |
1429 | 'with manual activation')), |
|
1429 | ('hg.register.auto_activate', _('User Registration with automatic account activation')), | |
1430 |
|
1430 | |||
1431 | ('hg.register.auto_activate', _('Register new user with RhodeCode ' |
|
1431 | ('hg.extern_activate.manual', _('Manual activation of external account')), | |
1432 | 'with auto activation')), |
|
1432 | ('hg.extern_activate.auto', _('Automatic activation of external account')), | |
|
1433 | ||||
1433 | ] |
|
1434 | ] | |
1434 |
|
1435 | |||
1435 | #definition of system default permissions for DEFAULT user |
|
1436 | #definition of system default permissions for DEFAULT user | |
@@ -1440,6 +1441,7 b' class Permission(Base, BaseModel):' | |||||
1440 | 'hg.create.repository', |
|
1441 | 'hg.create.repository', | |
1441 | 'hg.fork.repository', |
|
1442 | 'hg.fork.repository', | |
1442 | 'hg.register.manual_activate', |
|
1443 | 'hg.register.manual_activate', | |
|
1444 | 'hg.extern_activate.auto', | |||
1443 | ] |
|
1445 | ] | |
1444 |
|
1446 | |||
1445 | # defines which permissions are more important higher the more important |
|
1447 | # defines which permissions are more important higher the more important |
@@ -312,7 +312,7 b' def ApplicationUiSettingsForm():' | |||||
312 | def DefaultPermissionsForm(repo_perms_choices, group_perms_choices, |
|
312 | def DefaultPermissionsForm(repo_perms_choices, group_perms_choices, | |
313 | user_group_perms_choices, create_choices, |
|
313 | user_group_perms_choices, create_choices, | |
314 | repo_group_create_choices, user_group_create_choices, |
|
314 | repo_group_create_choices, user_group_create_choices, | |
315 | fork_choices, register_choices): |
|
315 | fork_choices, register_choices, extern_activate_choices): | |
316 | class _DefaultPermissionsForm(formencode.Schema): |
|
316 | class _DefaultPermissionsForm(formencode.Schema): | |
317 | allow_extra_fields = True |
|
317 | allow_extra_fields = True | |
318 | filter_extra_fields = True |
|
318 | filter_extra_fields = True | |
@@ -330,6 +330,7 b' def DefaultPermissionsForm(repo_perms_ch' | |||||
330 | default_fork = v.OneOf(fork_choices) |
|
330 | default_fork = v.OneOf(fork_choices) | |
331 |
|
331 | |||
332 | default_register = v.OneOf(register_choices) |
|
332 | default_register = v.OneOf(register_choices) | |
|
333 | default_extern_activate = v.OneOf(extern_activate_choices) | |||
333 | return _DefaultPermissionsForm |
|
334 | return _DefaultPermissionsForm | |
334 |
|
335 | |||
335 |
|
336 |
@@ -117,7 +117,8 b' class PermissionModel(BaseModel):' | |||||
117 | 'default_repo_create', |
|
117 | 'default_repo_create', | |
118 | #'default_repo_group_create', #not implemented yet |
|
118 | #'default_repo_group_create', #not implemented yet | |
119 | 'default_user_group_create', |
|
119 | 'default_user_group_create', | |
120 |
'default_fork', 'default_register' |
|
120 | 'default_fork', 'default_register', | |
|
121 | 'default_extern_activate']: | |||
121 | p = _make_new(perm_user, form_result[def_perm_key]) |
|
122 | p = _make_new(perm_user, form_result[def_perm_key]) | |
122 | self.sa.add(p) |
|
123 | self.sa.add(p) | |
123 |
|
124 |
@@ -110,6 +110,14 b'' | |||||
110 | ${h.select('default_register','',c.register_choices)} |
|
110 | ${h.select('default_register','',c.register_choices)} | |
111 | </div> |
|
111 | </div> | |
112 | </div> |
|
112 | </div> | |
|
113 | <div class="field"> | |||
|
114 | <div class="label"> | |||
|
115 | <label for="default_extern_activate">${_('External auth account activation')}:</label> | |||
|
116 | </div> | |||
|
117 | <div class="select"> | |||
|
118 | ${h.select('default_extern_activate','',c.extern_activate_choices)} | |||
|
119 | </div> | |||
|
120 | </div> | |||
113 | <div class="buttons"> |
|
121 | <div class="buttons"> | |
114 | ${h.submit('save',_('Save'),class_="ui-btn large")} |
|
122 | ${h.submit('save',_('Save'),class_="ui-btn large")} | |
115 | ${h.reset('reset',_('Reset'),class_="ui-btn large")} |
|
123 | ${h.reset('reset',_('Reset'),class_="ui-btn large")} |
General Comments 0
You need to be logged in to leave comments.
Login now