allura
Revisión | b71963345ea3a1be72ff9c68865ca21d934c927e (tree) |
---|---|
Tiempo | 2011-04-28 03:48:20 |
Autor | Rick Copeland <rcopeland@geek...> |
Commiter | Rick Copeland |
[#1909] Make bootstrap Projects nbhd the only one allowing willy-nilly registration
Signed-off-by: Rick Copeland <rcopeland@geek.net>
@@ -23,6 +23,7 @@ from ming.orm import session | ||
23 | 23 | from ming.orm import ThreadLocalORMSession |
24 | 24 | |
25 | 25 | from allura.lib import helpers as h |
26 | +from allura.lib import security | |
26 | 27 | from allura.lib import exceptions as forge_exc |
27 | 28 | |
28 | 29 | log = logging.getLogger(__name__) |
@@ -292,7 +293,7 @@ class ProjectRegistrationProvider(object): | ||
292 | 293 | ''' |
293 | 294 | return [] |
294 | 295 | |
295 | - def register_neighborhood_project(self, neighborhood, users): | |
296 | + def register_neighborhood_project(self, neighborhood, users, allow_register=False): | |
296 | 297 | from allura import model as M |
297 | 298 | shortname='--init--' |
298 | 299 | p = M.Project.query.get( |
@@ -321,6 +322,9 @@ class ProjectRegistrationProvider(object): | ||
321 | 322 | ThreadLocalORMSession.close_all() |
322 | 323 | log.exception('Error registering project %s' % p) |
323 | 324 | raise |
325 | + if allow_register: | |
326 | + role_auth = M.ProjectRole.authenticated(p) | |
327 | + security.simple_grant(p.acl, role_auth._id, 'register') | |
324 | 328 | return p |
325 | 329 | |
326 | 330 | def register_project(self, neighborhood, shortname, user, user_project): |
@@ -87,7 +87,7 @@ def bootstrap(command, conf, vars): | ||
87 | 87 | n_adobe = M.Neighborhood(name='Adobe', url_prefix='/adobe/') |
88 | 88 | assert tg.config['auth.method'] == 'local' |
89 | 89 | project_reg = plugin.ProjectRegistrationProvider.get() |
90 | - p_projects = project_reg.register_neighborhood_project(n_projects, [root]) | |
90 | + p_projects = project_reg.register_neighborhood_project(n_projects, [root], allow_register=True) | |
91 | 91 | p_users = project_reg.register_neighborhood_project(n_users, [root]) |
92 | 92 | p_adobe = project_reg.register_neighborhood_project(n_adobe, [root]) |
93 | 93 | ThreadLocalORMSession.flush_all() |