1
0
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:
xiez
2012-09-01 17:46:46 +08:00
parent 738c0e47e9
commit 12a6e0a87f
17 changed files with 190 additions and 44 deletions

View File

@@ -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