From 698918abf927fe7aa63ee3f70dfb7e02e5afd2db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Garc=C3=ADa=20S=C3=A1ez?= Date: Tue, 23 Feb 2016 15:08:15 +0100 Subject: [PATCH] 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 --- UI/Scheduler/UIxCalUserRightsEditor.m | 31 +++++++++++++-------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/UI/Scheduler/UIxCalUserRightsEditor.m b/UI/Scheduler/UIxCalUserRightsEditor.m index 00534bff8..91738707a 100644 --- a/UI/Scheduler/UIxCalUserRightsEditor.m +++ b/UI/Scheduler/UIxCalUserRightsEditor.m @@ -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]; } }