1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-14 14:21:23 +00:00

[api2] Clarify 403 error message

This commit is contained in:
zhengxie
2013-09-05 17:25:52 +08:00
parent 3a61898dec
commit 179c7a70dc
2 changed files with 101 additions and 22 deletions

30
seahub/api2/utils.py Normal file
View File

@@ -0,0 +1,30 @@
# Utility functions for api2
from seaserv import seafile_api
def is_repo_writable(repo_id, username):
"""Check whether a user has write permission to a repo.
Arguments:
- `repo_id`:
- `username`:
"""
if seafile_api.check_repo_access_permission(repo_id, username) == 'rw':
return True
else:
return False
def is_repo_accessible(repo_id, username):
"""Check whether a user can read or write to a repo.
Arguments:
- `repo_id`:
- `username`:
"""
if seafile_api.check_repo_access_permission(repo_id, username) is None:
return False
else:
return True