1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-08-31 23:19:36 +00:00

Repo can be set 'read-only' or 'normal' status.

Return 'status' in get_repo(s) apis.
This commit is contained in:
cuihaikuo
2019-03-11 14:35:41 +08:00
parent 78bef71a5f
commit 22f096a70a
12 changed files with 202 additions and 63 deletions

View File

@@ -2519,12 +2519,20 @@ check_access_token (const char *token,
{
SeafileWebAccess *webaccess;
const char *op;
const char *_repo_id;
webaccess = (SeafileWebAccess *)
seaf_web_at_manager_query_access_token (seaf->web_at_mgr, token);
if (!webaccess)
return -1;
_repo_id = seafile_web_access_get_repo_id (webaccess);
int status = seaf_repo_manager_get_repo_status(seaf->repo_mgr, _repo_id);
if (status != REPO_STATUS_NORMAL) {
g_object_unref (webaccess);
return -1;
}
/* token with op = "upload" can only be used for "upload-*" operations;
* token with op = "update" can only be used for "update-*" operations.
*/
@@ -2540,7 +2548,7 @@ check_access_token (const char *token,
return -1;
}
*repo_id = g_strdup (seafile_web_access_get_repo_id (webaccess));
*repo_id = g_strdup (_repo_id);
*user = g_strdup (seafile_web_access_get_username (webaccess));
g_object_unref (webaccess);