diff --git a/ChangeLog b/ChangeLog index 1b7288f25..d85bf9323 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2007-05-17 Wolfgang Sourdeau + * UI/Common/UIxUserRightsEditor.m ([UIxUserRightsEditor + -_initRights]): don't take the "None" role into account when + initializing the list of current roles. + * SoObjects/SOGo/SOGoPermissions.m: added a new void role "SOGoRole_None". diff --git a/UI/Common/UIxUserRightsEditor.m b/UI/Common/UIxUserRightsEditor.m index 35b697612..8ec44dd46 100644 --- a/UI/Common/UIxUserRightsEditor.m +++ b/UI/Common/UIxUserRightsEditor.m @@ -24,6 +24,7 @@ #import #import #import +#import #import "UIxUserRightsEditor.h" @@ -52,10 +53,15 @@ return uid; } +- (BOOL) userIsDefaultUser +{ + return [uid isEqualToString: SOGoDefaultUserID]; +} + - (NSString *) userDisplayName { LDAPUserManager *um; - + um = [LDAPUserManager sharedUserManager]; return [NSString stringWithFormat: @"%@ <%@>", @@ -66,9 +72,10 @@ - (BOOL) _initRights { BOOL response; - NSString *newUID, *email; + NSString *newUID; LDAPUserManager *um; SOGoObject *clientObject; + unsigned int count; response = NO; @@ -76,15 +83,17 @@ if ([newUID length] > 0) { um = [LDAPUserManager sharedUserManager]; - email = [um getEmailForUID: newUID]; - if ([email length] > 0) + if ([newUID isEqualToString: SOGoDefaultUserID] + || [[um getEmailForUID: newUID] length] > 0) { ASSIGN (uid, newUID); clientObject = [self clientObject]; [userRights addObjectsFromArray: [clientObject aclsForUser: uid]]; - if (![userRights count]) - [userRights addObjectsFromArray: [clientObject defaultAclRoles]]; - + count = [userRights count]; + if (!count || (count == 1 && [[userRights objectAtIndex: 0] + isEqualToString: SOGoRole_None])) + [userRights setArray: [clientObject defaultAclRoles]]; + response = YES; } } @@ -118,8 +127,7 @@ else { [self updateRights]; - [[self clientObject] setRoles: userRights - forUser: uid]; + [[self clientObject] setRoles: userRights forUser: uid]; response = [self jsCloseWithRefreshMethod: nil]; } diff --git a/UI/Templates/ContactsUI/UIxContactsUserRightsEditor.wox b/UI/Templates/ContactsUI/UIxContactsUserRightsEditor.wox index e14ea785f..39b25787d 100644 --- a/UI/Templates/ContactsUI/UIxContactsUserRightsEditor.wox +++ b/UI/Templates/ContactsUI/UIxContactsUserRightsEditor.wox @@ -13,8 +13,13 @@
- + + + +