# HG changeset patch # User Timo Sirainen # Date 1257898416 18000 # Node ID 76ff6831c9ae1ad8f9f80da87db7c5dacaf9193b # Parent 38d89637aa2305038d585059009a287604b30290 acl: Merge group rights if user belongs to more than one. diff -r 38d89637aa23 -r 76ff6831c9ae src/plugins/acl/acl-backend-vfile.c --- a/src/plugins/acl/acl-backend-vfile.c Tue Nov 10 19:12:51 2009 -0500 +++ b/src/plugins/acl/acl-backend-vfile.c Tue Nov 10 19:13:36 2009 -0500 @@ -752,6 +752,7 @@ struct mail_namespace *ns; struct acl_object *_aclobj = &aclobj->aclobj; struct acl_rights_update ru, ru2; + enum acl_modify_mode add_mode; const struct acl_rights *rights; unsigned int i, count; bool owner_applied, first_global = TRUE; @@ -784,10 +785,13 @@ /* If [neg_]rights is NULL it needs to be ignored. The easiest way to do that is to just mark it with REMOVE mode */ + add_mode = i > 0 && rights[i-1].id_type == rights[i].id_type && + rights[i-1].global == rights[i].global ? + ACL_MODIFY_MODE_ADD : ACL_MODIFY_MODE_REPLACE; ru.modify_mode = rights[i].rights == NULL ? - ACL_MODIFY_MODE_REMOVE : ACL_MODIFY_MODE_REPLACE; + ACL_MODIFY_MODE_REMOVE : add_mode; ru.neg_modify_mode = rights[i].neg_rights == NULL ? - ACL_MODIFY_MODE_REMOVE : ACL_MODIFY_MODE_REPLACE; + ACL_MODIFY_MODE_REMOVE : add_mode; ru.rights = rights[i]; if (rights[i].global && first_global) { /* first global: reset negative ACLs so local ACLs