From ba2271f7aa98e43d19b37633b6e27be59aef1417 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 15 Jul 2010 14:48:45 +0000 Subject: [PATCH] Monotone-Parent: e7e44b2de3f556e55bfeb9b485ea6d66a7f93772 Monotone-Revision: 661c78a6b95a6fc152c41fa5888b92e92c73e92f Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-07-15T14:48:45 Monotone-Branch: ca.inverse.sogo --- SoObjects/SOGo/SOGoObject.h | 4 ++++ SoObjects/SOGo/SOGoObject.m | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/SoObjects/SOGo/SOGoObject.h b/SoObjects/SOGo/SOGoObject.h index 2daaa8abb..44e30bfa4 100644 --- a/SoObjects/SOGo/SOGoObject.h +++ b/SoObjects/SOGo/SOGoObject.h @@ -98,6 +98,10 @@ - (void) setOwner: (NSString *) newOwner; - (NSString *) ownerInContext: (id) _ctx; +/* a helper that determines whether access rights can be ignored on + an object */ +- (BOOL) ignoreRights; + /* looking up shared objects */ - (SOGoUserFolder *) lookupUserFolder; diff --git a/SoObjects/SOGo/SOGoObject.m b/SoObjects/SOGo/SOGoObject.m index da6547c84..f48aadd32 100644 --- a/SoObjects/SOGo/SOGoObject.m +++ b/SoObjects/SOGo/SOGoObject.m @@ -229,6 +229,25 @@ return owner; } +- (BOOL) ignoreRights +{ + SOGoUser *currentUser; + NSString *login; + BOOL ignoreRights; + + if (activeUserIsOwner) + ignoreRights = YES; + else + { + currentUser = [context activeUser]; + login = [currentUser login]; + ignoreRights = ([login isEqualToString: [self ownerInContext: context]] + || [currentUser isSuperUser]); + } + + return ignoreRights; +} + - (BOOL) isInPublicZone { if (!isInPublicZone)