mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-11 09:51:23 +00:00
Fix prepareRightsForm, keep the highest role
userRights is sorted highest to lowest right so we have to assign only the first right found for each type
This commit is contained in:
@@ -57,25 +57,24 @@
|
||||
{
|
||||
NSEnumerator *roles, *types;
|
||||
NSString *role, *type;
|
||||
unsigned int length;
|
||||
|
||||
roles = [userRights objectEnumerator];
|
||||
role = [roles nextObject];
|
||||
while (role)
|
||||
types = [[self rightTypes] objectEnumerator];
|
||||
type = [types nextObject];
|
||||
while (type)
|
||||
{
|
||||
types = [[self rightTypes] objectEnumerator];
|
||||
type = [types nextObject];
|
||||
while (type)
|
||||
{
|
||||
if ([role hasPrefix: type])
|
||||
{
|
||||
length = [type length];
|
||||
[rights setObject: [role substringFromIndex: length]
|
||||
forKey: type];
|
||||
}
|
||||
type = [types nextObject];
|
||||
}
|
||||
roles = [userRights objectEnumerator];
|
||||
role = [roles nextObject];
|
||||
while (role)
|
||||
{
|
||||
if ([role hasPrefix: type])
|
||||
{
|
||||
[rights setObject: [role substringFromIndex: [type length]]
|
||||
forKey: type];
|
||||
break;
|
||||
}
|
||||
role = [roles nextObject];
|
||||
}
|
||||
type = [types nextObject];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user