Beispiel #1
0
def delete_repo(id):
    repo = repos.get_repo_by_id(id)
    repo_acls = repos.get_repo_acls(repo_id=repo['repository_id'],
                                    user_id=request.user['user_id'])
    if not repo_acls or len(repo_acls) < 1 or not repo_acls[0]['is_owner']:
        raise Exception("Permission denied; user doesn't own this repository.")
    repos.delete_repo_by_id(id)
    return redirect(url_for('list_repos'))
Beispiel #2
0
def delete_repo(id):
    repo = repos.get_repo_by_id(id)
    repo_acls = repos.get_repo_acls(
        repo_id=repo['repository_id'],
        user_id=request.user['user_id'])
    if not repo_acls or len(repo_acls) < 1 or not repo_acls[0]['is_owner']:
        raise Exception("Permission denied; user doesn't own this repository.")
    repos.delete_repo_by_id(id)
    return redirect(url_for('list_repos'))
Beispiel #3
0
def render_repo_details(id, template):
    repo = repos.get_repo_by_id(id)
    repo_acls = repos.get_repo_acls(repo_id=repo['repository_id'])
    user_id = request.user['user_id']
    user_acls = [a for a in repo_acls if a['user_id'] == user_id][0]

    # get our hostname for the git clone example
    import urlparse
    parsed_url = urlparse.urlparse(request.url)

    return render_template(template,
        repo=repo,
        repo_acls=repo_acls,
        hostname=parsed_url.hostname,
        user_acls=user_acls)
Beispiel #4
0
def render_repo_details(id, template):
    repo = repos.get_repo_by_id(id)
    repo_acls = repos.get_repo_acls(repo_id=repo['repository_id'])
    user_id = request.user['user_id']
    user_acls = [a for a in repo_acls if a['user_id'] == user_id][0]

    # get our hostname for the git clone example
    import urlparse
    parsed_url = urlparse.urlparse(request.url)

    return render_template(template,
                           repo=repo,
                           repo_acls=repo_acls,
                           hostname=parsed_url.hostname,
                           user_acls=user_acls)