Skip to content

Commit

Permalink
fix(calendar): Fix issue where a calendar's subscribed user can give …
Browse files Browse the repository at this point in the history
…acl to another user
  • Loading branch information
WoodySlum committed Apr 3, 2024
1 parent 0fafda5 commit cb55413
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions SoObjects/SOGo/SOGoObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -1399,6 +1399,10 @@ - (NSString *) _davAclActionFromQuery: (id <DOMDocument>) document
}
else if ([nodeName isEqualToString: @"set-roles"])
{
// Disable Acl modifications if this is not the owner
if (![[[context activeUser] login] isEqualToString: owner])
return nil;

// We support two ways of setting roles. The first one is, for example:
//
// <?xml version="1.0" encoding="UTF-8"?>
Expand Down Expand Up @@ -1426,8 +1430,7 @@ - (NSString *) _davAclActionFromQuery: (id <DOMDocument>) document
allRoles = [self _davGetRolesFromRequest: node];
for (i = 0; i < [allUsers count]; i++)
{
if ([[[context activeUser] login] isEqualToString: owner])
[self setRoles: allRoles
[self setRoles: allRoles
forUser: [allUsers objectAtIndex: i]];
}
result = @"";
Expand All @@ -1447,6 +1450,9 @@ - (NSString *) _davAclActionFromQuery: (id <DOMDocument>) document
//
else if ([nodeName isEqualToString: @"add-user"])
{
// Disable Acl modifications if this is not the owner
if (![[[context activeUser] login] isEqualToString: owner])
return nil;
attrs = [node attributes];
userAttr = [attrs namedItem: @"user"];
user = [userAttr nodeValue];
Expand All @@ -1455,6 +1461,9 @@ - (NSString *) _davAclActionFromQuery: (id <DOMDocument>) document
}
else if ([nodeName isEqualToString: @"add-users"])
{
// Disable Acl modifications if this is not the owner
if (![[[context activeUser] login] isEqualToString: owner])
return nil;
attrs = [node attributes];
userAttr = [attrs namedItem: @"users"];
allUsers = [[userAttr nodeValue] componentsSeparatedByString: @","];
Expand All @@ -1475,6 +1484,9 @@ - (NSString *) _davAclActionFromQuery: (id <DOMDocument>) document
//
else if ([nodeName isEqualToString: @"remove-user"])
{
// Disable Acl modifications if this is not the owner
if (![[[context activeUser] login] isEqualToString: owner])
return nil;
attrs = [node attributes];
userAttr = [attrs namedItem: @"user"];
user = [userAttr nodeValue];
Expand Down

0 comments on commit cb55413

Please sign in to comment.