mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-26 15:26:19 +00:00
Fixed a few bugs related to org. Using with tag to wrap template include
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import sys
|
||||
|
||||
from seaserv import get_org_id_by_repo_id
|
||||
from seaserv import get_org_id_by_repo_id, list_org_repos_by_owner
|
||||
|
||||
def access_org_repo(request, repo_id):
|
||||
"""
|
||||
@@ -11,3 +11,14 @@ def access_org_repo(request, repo_id):
|
||||
cur_org_id = request.user.org['org_id']
|
||||
org_id = get_org_id_by_repo_id(repo_id)
|
||||
return True if cur_org_id == org_id else False
|
||||
|
||||
def validate_org_repo_owner(org_id, repo_id, user):
|
||||
"""
|
||||
Check whether user is the owner of org repo.
|
||||
"""
|
||||
org_repos = list_org_repos_by_owner(org_id, user)
|
||||
print org_id, user, org_repos
|
||||
for r in org_repos:
|
||||
if r.id == repo_id:
|
||||
return True
|
||||
return False
|
||||
|
Reference in New Issue
Block a user