Beispiel #1
0
 def fork(self, project_id=None, mount_point=None, mount_label=None):
     # this shows the form and handles the submission
     security.require_authenticated()
     if not c.app.forkable: raise exc.HTTPNotFound
     from_repo = c.app.repo
     ThreadLocalORMSession.flush_all()
     ThreadLocalORMSession.close_all()
     from_project = c.project
     to_project = M.Project.query.get(_id=ObjectId(project_id))
     mount_label = mount_label or '%s - %s' % (c.project.name, c.app.config.options.mount_label)
     mount_point = (mount_point or from_project.shortname)
     if request.method != 'POST' or not mount_point:
         return dict(from_repo=from_repo,
                     user_project=c.user.private_project(),
                     mount_point=mount_point,
                     mount_label=mount_label)
     else:
         with h.push_config(c, project=to_project):
             if not to_project.database_configured:
                 to_project.configure_project(is_user_project=True)
             security.require(security.has_access(to_project, 'admin'))
             try:
                 to_project.install_app(
                     ep_name=from_repo.tool_name,
                     mount_point=mount_point,
                     mount_label=mount_label,
                     cloned_from_project_id=from_project._id,
                     cloned_from_repo_id=from_repo._id)
                 redirect(to_project.url()+mount_point+'/')
             except exc.HTTPRedirection:
                 raise
             except Exception, ex:
                 flash(str(ex), 'error')
                 redirect(request.referer)
 def request_merge(self, branch=None, **kw):
     security.require(security.has_access(c.app.repo, 'admin'))
     c.form = self.mr_widget
     if branch in c.form.source_branches:
         source_branch = branch
     else:
         source_branch = c.app.default_branch_name
     with c.app.repo.push_upstream_context():
         target_branch = c.app.default_branch_name
     return {
         'source_branch': source_branch,
         'target_branch': target_branch,
     }
 def _check_security(self):
     security.require(security.has_access(c.app, 'read'))
 def save(self, status=None, **kw):
     security.require(
         security.has_access(self.req, 'write'), 'Write access required')
     self.req.status = status
     redirect('.')
Beispiel #5
0
 def needs_project_access_ok(self):
     pred = has_access(c.project, 'read')
     if not pred():
         log.info('Inside needs_project_access, c.user = %s' % c.user)
     require(pred)
     return ''
Beispiel #6
0
 def forbidden(self):
     require(lambda:False, 'Never allowed')
     return ''
Beispiel #7
0
 def request_merge(self, branch=None):
     security.require(security.has_access(c.app.repo, 'admin'))
     c.form = self.mr_widget
     if branch is None:
         source_branch = c.app.repo.branches[0].name
     return dict(source_branch=source_branch)
 def needs_project_access_ok(self):
     pred = has_access(c.project, 'read')
     if not pred():
         log.info('Inside needs_project_access, c.user = %s' % c.user)
     require(pred)
     return ''
 def forbidden(self):
     require(lambda: False, 'Never allowed')
     return ''
Beispiel #10
0
 def request_merge(self, branch=None):
     security.require(security.has_access(c.app.repo, 'admin'))
     c.form = self.mr_widget
     if branch is None:
         source_branch=c.app.repo.branches[0].name
     return dict(source_branch=source_branch)
 def _check_security(self):
     security.require(security.has_access(c.app, 'read'))
 def save(self, status=None):
     security.require(
         security.has_access(self.req, 'write'), 'Write access required')
     self.req.status = status
     redirect('.')