|
... |
|
... |
326 |
role_auth = M.ProjectRole.authenticated(p)
|
326 |
role_auth = M.ProjectRole.authenticated(p)
|
327 |
security.simple_grant(p.acl, role_auth._id, 'register')
|
327 |
security.simple_grant(p.acl, role_auth._id, 'register')
|
328 |
state(p).soil()
|
328 |
state(p).soil()
|
329 |
return p
|
329 |
return p
|
330 |
|
330 |
|
331 |
def register_project(self, neighborhood, shortname, user, user_project):
|
331 |
def register_project(self, neighborhood, shortname, user, user_project, private_project):
|
332 |
'''Register a new project in the neighborhood. The given user will
|
332 |
'''Register a new project in the neighborhood. The given user will
|
333 |
become the project's superuser. If no user is specified, c.user is used.
|
333 |
become the project's superuser. If no user is specified, c.user is used.
|
334 |
'''
|
334 |
'''
|
335 |
from allura import model as M
|
335 |
from allura import model as M
|
336 |
assert h.re_path_portion.match(shortname.replace('/', '')), \
|
336 |
assert h.re_path_portion.match(shortname.replace('/', '')), \
|
|
... |
|
... |
347 |
database_uri=M.Project.default_database_uri(shortname),
|
347 |
database_uri=M.Project.default_database_uri(shortname),
|
348 |
last_updated = datetime.utcnow(),
|
348 |
last_updated = datetime.utcnow(),
|
349 |
is_root=True)
|
349 |
is_root=True)
|
350 |
p.configure_project(
|
350 |
p.configure_project(
|
351 |
users=[user],
|
351 |
users=[user],
|
352 |
is_user_project=user_project)
|
352 |
is_user_project=user_project,
|
|
|
353 |
is_private_project=private_project)
|
353 |
except forge_exc.ProjectConflict:
|
354 |
except forge_exc.ProjectConflict:
|
354 |
raise
|
355 |
raise
|
355 |
except:
|
356 |
except:
|
356 |
ThreadLocalORMSession.close_all()
|
357 |
ThreadLocalORMSession.close_all()
|
357 |
log.exception('Error registering project %s' % p)
|
358 |
log.exception('Error registering project %s' % p)
|