mirror of
https://github.com/haiwen/seafile-server.git
synced 2025-07-01 17:31:54 +00:00
del check group staff (#339)
This commit is contained in:
parent
52586639ac
commit
41dba24d8b
@ -539,28 +539,12 @@ int ccnet_group_manager_add_member (CcnetGroupManager *mgr,
|
|||||||
{
|
{
|
||||||
CcnetDB *db = mgr->priv->db;
|
CcnetDB *db = mgr->priv->db;
|
||||||
|
|
||||||
/* check whether user is the staff of the group */
|
|
||||||
if (!check_group_staff (db, group_id, user_name, TRUE)) {
|
|
||||||
g_set_error (error, CCNET_DOMAIN, 0,
|
|
||||||
"Permission error: only group staff can add member");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check whether group exists */
|
/* check whether group exists */
|
||||||
if (!check_group_exists (mgr, db, group_id)) {
|
if (!check_group_exists (mgr, db, group_id)) {
|
||||||
g_set_error (error, CCNET_DOMAIN, 0, "Group not exists");
|
g_set_error (error, CCNET_DOMAIN, 0, "Group not exists");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check whether group is full */
|
|
||||||
/* snprintf (sql, sizeof(sql), "SELECT count(group_id) FROM `GroupUser` " */
|
|
||||||
/* "WHERE `group_id` = %d", group_id); */
|
|
||||||
/* int count = seaf_db_get_int (db, sql); */
|
|
||||||
/* if (count >= MAX_GROUP_MEMBERS) { */
|
|
||||||
/* g_set_error (error, CCNET_DOMAIN, 0, "Group is full"); */
|
|
||||||
/* return -1; */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
char *member_name_l = g_ascii_strdown (member_name, -1);
|
char *member_name_l = g_ascii_strdown (member_name, -1);
|
||||||
int rc = seaf_db_statement_query (db, "INSERT INTO GroupUser (group_id, user_name, is_staff) VALUES (?, ?, ?)",
|
int rc = seaf_db_statement_query (db, "INSERT INTO GroupUser (group_id, user_name, is_staff) VALUES (?, ?, ?)",
|
||||||
3, "int", group_id, "string", member_name_l,
|
3, "int", group_id, "string", member_name_l,
|
||||||
@ -583,13 +567,6 @@ int ccnet_group_manager_remove_member (CcnetGroupManager *mgr,
|
|||||||
CcnetDB *db = mgr->priv->db;
|
CcnetDB *db = mgr->priv->db;
|
||||||
char *sql;
|
char *sql;
|
||||||
|
|
||||||
/* check whether user is the staff of the group */
|
|
||||||
if (!check_group_staff (db, group_id, user_name, TRUE)) {
|
|
||||||
g_set_error (error, CCNET_DOMAIN, 0,
|
|
||||||
"Only group staff can remove member");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check whether group exists */
|
/* check whether group exists */
|
||||||
if (!check_group_exists (mgr, db, group_id)) {
|
if (!check_group_exists (mgr, db, group_id)) {
|
||||||
g_set_error (error, CCNET_DOMAIN, 0, "Group not exists");
|
g_set_error (error, CCNET_DOMAIN, 0, "Group not exists");
|
||||||
|
Loading…
Reference in New Issue
Block a user