mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-12 10:21:22 +00:00
Modification for ContactsUserRightsEditor
This commit is contained in:
committed by
Francis Lachapelle
parent
3f27e9bb57
commit
29d114188f
@@ -22,6 +22,7 @@
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSEnumerator.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
#import <SoObjects/SOGo/SOGoPermissions.h>
|
||||
|
||||
@@ -34,70 +35,51 @@
|
||||
return [userRights containsObject: SOGoRole_ObjectCreator];
|
||||
}
|
||||
|
||||
- (void) setUserCanEraseObjects: (BOOL) userCanEraseObjects
|
||||
{
|
||||
if (userCanEraseObjects)
|
||||
[self appendRight: SOGoRole_ObjectEraser];
|
||||
else
|
||||
[self removeRight: SOGoRole_ObjectEraser];
|
||||
}
|
||||
|
||||
- (BOOL) userCanEraseObjects
|
||||
{
|
||||
return [userRights containsObject: SOGoRole_ObjectEraser];
|
||||
}
|
||||
|
||||
- (void) setUserCanEditObjects: (BOOL) userCanEditObjects
|
||||
{
|
||||
if (userCanEditObjects)
|
||||
[self appendRight: SOGoRole_ObjectEditor];
|
||||
else
|
||||
[self removeRight: SOGoRole_ObjectEditor];
|
||||
}
|
||||
|
||||
- (BOOL) userCanEditObjects
|
||||
{
|
||||
return [userRights containsObject: SOGoRole_ObjectEditor];
|
||||
}
|
||||
|
||||
- (void) setUserCanViewObjects: (BOOL) userCanViewObjects
|
||||
{
|
||||
if (userCanViewObjects)
|
||||
[self appendRight: SOGoRole_ObjectViewer];
|
||||
else
|
||||
[self removeRight: SOGoRole_ObjectViewer];
|
||||
}
|
||||
|
||||
- (BOOL) userCanViewObjects
|
||||
{
|
||||
return [userRights containsObject: SOGoRole_ObjectViewer];
|
||||
}
|
||||
|
||||
- (void) updateRights
|
||||
- (NSDictionary *) userRightsForObject
|
||||
{
|
||||
WORequest *request;
|
||||
return [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:[self userCanCreateObjects]], @"canCreateObjects",
|
||||
[NSNumber numberWithBool:[self userCanEraseObjects]], @"canEraseObjects",
|
||||
[NSNumber numberWithBool:[self userCanEditObjects]], @"canEditObjects",
|
||||
[NSNumber numberWithBool:[self userCanViewObjects]], @"canViewObjects", nil];
|
||||
}
|
||||
|
||||
request = [context request];
|
||||
- (void) updateRights: (NSDictionary *) newRights
|
||||
{
|
||||
|
||||
if ([[request formValueForKey: @"ObjectCreator"] length] > 0)
|
||||
if ([[newRights objectForKey: @"canCreateObjects"] boolValue])
|
||||
[self appendRight: SOGoRole_ObjectCreator];
|
||||
else
|
||||
[self removeRight: SOGoRole_ObjectCreator];
|
||||
|
||||
if ([[request formValueForKey: @"ObjectEditor"] length] > 0)
|
||||
if ([[newRights objectForKey: @"canEditObjects"] boolValue])
|
||||
[self appendRight: SOGoRole_ObjectEditor];
|
||||
else
|
||||
[self removeRight: SOGoRole_ObjectEditor];
|
||||
|
||||
if ([[request formValueForKey: @"ObjectViewer"] length] > 0)
|
||||
if ([[newRights objectForKey: @"canViewObjects"] boolValue])
|
||||
[self appendRight: SOGoRole_ObjectViewer];
|
||||
else
|
||||
[self removeRight: SOGoRole_ObjectViewer];
|
||||
|
||||
if ([[request formValueForKey: @"ObjectEraser"] length] > 0)
|
||||
if ([[newRights objectForKey: @"canEraseObjects"] boolValue])
|
||||
[self appendRight: SOGoRole_ObjectEraser];
|
||||
else
|
||||
[self removeRight: SOGoRole_ObjectEraser];
|
||||
}
|
||||
|
||||
@end
|
||||
@end
|
||||
Reference in New Issue
Block a user