Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubAclService.h URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubAclService.h?rev=1795295&view=auto ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubAclService.h (added) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubAclService.h Tue May 16 10:33:32 2017 @@ -0,0 +1,24 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +#import "CMISAtomPubBaseService.h" + +@interface CMISAtomPubAclService : CMISAtomPubBaseService <CMISAclService> + +@end
Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubAclService.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubAclService.m?rev=1795295&view=auto ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubAclService.m (added) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubAclService.m Tue May 16 10:33:32 2017 @@ -0,0 +1,52 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +#import "CMISAtomPubAclService.h" +#import "CMISErrors.h" + +@implementation CMISAtomPubAclService + +-(CMISRequest *)retrieveAcl:(id)objectId + onlyBasicPermissions:(BOOL)onlyBasicPermissions + completionBlock:(void (^)(CMISAcl *, NSError *))completionBlock +{ + // TODO implement + completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeRuntime detailedDescription:@"not implemented!"]); + return nil; +} + +-(CMISRequest *)applyAcl:(id)objectId addAces:(CMISAcl *)addAces + removeAces:(CMISAcl *)removeAces + aclPropagation:(CMISAclPropagation)aclPropagation + completionBlock:(void (^)(CMISAcl *, NSError *))completionBlock +{ + // TODO implement + completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeRuntime detailedDescription:@"not implemented!"]); + return nil; +} + +-(CMISRequest *)setAcl:(id)objectId aces:(CMISAcl *)aces + completionBlock:(void (^)(CMISAcl *, NSError *))completionBlock +{ + // TODO implement + completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeRuntime detailedDescription:@"not implemented!"]); + return nil; +} + +@end Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBinding.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBinding.m?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBinding.m (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubBinding.m Tue May 16 10:33:32 2017 @@ -24,6 +24,7 @@ #import "CMISAtomPubNavigationService.h" #import "CMISAtomPubVersioningService.h" #import "CMISAtomPubDiscoveryService.h" +#import "CMISAtomPubAclService.h" @interface CMISAtomPubBinding () @@ -48,6 +49,7 @@ if (self) { self.session = [[CMISBindingSession alloc] initWithSessionParameters:sessionParameters]; + self.aclService = [[CMISAtomPubAclService alloc] initWithBindingSession:self.session]; self.repositoryService = [[CMISAtomPubRepositoryService alloc] initWithBindingSession:self.session]; self.objectService = [[CMISAtomPubObjectService alloc] initWithBindingSession:self.session]; self.navigationService = [[CMISAtomPubNavigationService alloc] initWithBindingSession:self.session]; Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubDiscoveryService.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubDiscoveryService.m?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubDiscoveryService.m (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubDiscoveryService.m Tue May 16 10:33:32 2017 @@ -19,9 +19,9 @@ #import "CMISAtomPubDiscoveryService.h" #import "CMISQueryAtomEntryWriter.h" -#import "CMISHttpResponse.h" #import "CMISAtomPubConstants.h" #import "CMISAtomFeedParser.h" +#import "CMISHttpResponse.h" #import "CMISObjectList.h" #import "CMISErrors.h" #import "CMISLog.h" @@ -92,4 +92,17 @@ includeAllowableActions:(BOOL)includeAll return request; } -@end \ No newline at end of file +- (CMISRequest*)retrieveContentChanges:(CMISStringInOutParameter *)changeLogTokenParam + includeProperties:(BOOL)includeProperties + filter:(NSString *)filter + includePolicyIds:(BOOL)includePolicyIds + includeAcl:(BOOL)includeAcl + maxItems:(NSNumber *)maxItems + completionBlock:(void (^)(CMISObjectList *objectList, NSError *error))completionBlock +{ + // TODO implement + completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeRuntime detailedDescription:@"not implemented!"]); + return nil; +} + +@end Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectByIdUriBuilder.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectByIdUriBuilder.m?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectByIdUriBuilder.m (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectByIdUriBuilder.m Tue May 16 10:33:32 2017 @@ -73,7 +73,7 @@ urlString = [NSString stringWithFormat:@"%@&returnVersion=%@", urlString, returnVersionParam]; } - return [NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; + return [NSURL URLWithString:[urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]]; } -@end \ No newline at end of file +@end Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectByPathUriBuilder.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectByPathUriBuilder.m?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectByPathUriBuilder.m (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/AtomPub/CMISAtomPubObjectByPathUriBuilder.m Tue May 16 10:33:32 2017 @@ -56,8 +56,8 @@ } urlString = [urlString stringByReplacingOccurrencesOfString:@"{includeRelationships}" withString:includeRelationShipParam]; - return [NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; + return [NSURL URLWithString:[urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]]; } -@end \ No newline at end of file +@end Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBroswerFormDataWriter.h URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBroswerFormDataWriter.h?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBroswerFormDataWriter.h (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBroswerFormDataWriter.h Tue May 16 10:33:32 2017 @@ -18,7 +18,9 @@ */ #import <Foundation/Foundation.h> -#import "CMISProperties.h" + +@class CMISProperties; +@class CMISAcl; @interface CMISBroswerFormDataWriter : NSObject @@ -30,6 +32,10 @@ - (void)addParameter:(NSString *)name boolValue:(BOOL)value; +- (void)addAcesParameters:(CMISAcl *)acl; + +- (void)addRemoveAcesParameters:(CMISAcl *)acl; + /// if the fileName is not set the value of the property with id kCMISPropertyName will be used for the form data content name - (void)addPropertiesParameters:(CMISProperties *)properties; Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBroswerFormDataWriter.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBroswerFormDataWriter.m?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBroswerFormDataWriter.m (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBroswerFormDataWriter.m Tue May 16 10:33:32 2017 @@ -24,6 +24,9 @@ #import "CMISLog.h" #import "CMISMimeHelper.h" #import "CMISURLUtil.h" +#import "CMISAcl.h" +#import "CMISAce.h" +#import "CMISProperties.h" NSString * const kCMISFormDataContentTypeUrlEncoded = @"application/x-www-form-urlencoded;charset=utf-8"; NSString * const kCMISFormDataContentTypeFormData = @"multipart/form-data; boundary="; @@ -74,6 +77,41 @@ NSString * const kCMISFormDataContentTyp [self addParameter:name value:(value? kCMISParameterValueTrue : kCMISParameterValueFalse)]; } +- (void)addAcesParameters:(CMISAcl *)acl +{ + [self addAcesParameters:acl principalControl:kCMISBrowserJSONControlAddAcePrincipal permissionControl:kCMISBrowserJSONControlAddAcePermission]; +} + +- (void)addRemoveAcesParameters:(CMISAcl *)acl +{ + [self addAcesParameters:acl principalControl:kCMISBrowserJSONControlRemoveAcePrincipal permissionControl:kCMISBrowserJSONControlRemoveAcePermission]; +} + +- (void)addAcesParameters:(CMISAcl *)acl principalControl:(NSString *)principalControl permissionControl:(NSString *)permissionControl +{ + if (!acl || !acl.aces) { + return; + } + + int idx = 0; + for (CMISAce *ace in acl.aces) { + if (ace.principalId && ace.permissions.count > 0) { + NSString *idxStr = [NSString stringWithFormat:@"[%d]", idx]; + [self addParameter:[NSString stringWithFormat:@"%@%@", principalControl, idxStr] value:ace.principalId]; + + int permIdx = 0; + for (NSString *perm in ace.permissions) { + if (perm) { + NSString *permIdxStr = [NSString stringWithFormat:@"[%d]", permIdx]; + [self addParameter:[NSString stringWithFormat:@"%@%@%@", permissionControl, idxStr, permIdxStr] value:perm]; + permIdx++; + } + } + idx++; + } + } +} + - (void)addSuccinctFlag:(BOOL)succinct { if (succinct) { Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserAclService.h URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserAclService.h?rev=1795295&view=auto ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserAclService.h (added) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserAclService.h Tue May 16 10:33:32 2017 @@ -0,0 +1,24 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +#import "CMISBrowserBaseService.h" + +@interface CMISBrowserAclService : CMISBrowserBaseService <CMISAclService> + +@end Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserAclService.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserAclService.m?rev=1795295&view=auto ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserAclService.m (added) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserAclService.m Tue May 16 10:33:32 2017 @@ -0,0 +1,153 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +#import "CMISBrowserAclService.h" +#import "CMISConstants.h" +#import "CMISBrowserConstants.h" +#import "CMISURLUtil.h" +#import "CMISRequest.h" +#import "CMISHttpResponse.h" +#import "CMISBrowserUtil.h" +#import "CMISEnums.h" +#import "CMISBroswerFormDataWriter.h" +#import "CMISAce.h" +#import "CMISErrors.h" + +@implementation CMISBrowserAclService + +-(CMISRequest *)retrieveAcl:(NSString *)objectId + onlyBasicPermissions:(BOOL)onlyBasicPermissions + completionBlock:(void (^)(CMISAcl *, NSError *))completionBlock +{ + // build URL + NSString *objectUrl = [self retrieveObjectUrlForObjectWithId:objectId selector:kCMISBrowserJSONSelectorAcl]; + objectUrl = [CMISURLUtil urlStringByAppendingParameter:kCMISParameterOnlyBasicPermissions boolValue:onlyBasicPermissions urlString:objectUrl]; + + // read and parse + CMISRequest *cmisRequest = [[CMISRequest alloc] init]; + [self.bindingSession.networkProvider invokeGET:[NSURL URLWithString:objectUrl] + session:self.bindingSession + cmisRequest:cmisRequest + completionBlock:^(CMISHttpResponse *httpResponse, NSError *error) { + if (httpResponse.statusCode == 200 && httpResponse.data) { + [CMISBrowserUtil aclFromJSONData:httpResponse.data completionBlock:^(CMISAcl *acl, NSError *error) { + if (error) { + completionBlock(nil, error); + } else { + completionBlock(acl, nil); + } + }]; + } else { + completionBlock(nil, error); + } + }]; + + return cmisRequest; +} + +- (CMISRequest*)applyAcl:objectId + addAces:(CMISAcl *)addAces + removeAces:(CMISAcl *)removeAces + aclPropagation:(CMISAclPropagation)aclPropagation + completionBlock:(void (^)(CMISAcl *acl, NSError *error))completionBlock +{ + CMISRequest *cmisRequest = [[CMISRequest alloc] init]; + + [self internalApplyAcl:objectId + addAces:addAces + removeAces:removeAces + aclPropagation:aclPropagation + cmisRequest:cmisRequest + completionBlock:completionBlock]; + + return cmisRequest; +} + +- (CMISRequest*)internalApplyAcl:objectId + addAces:(CMISAcl *)addAces + removeAces:(CMISAcl *)removeAces + aclPropagation:(CMISAclPropagation)aclPropagation + cmisRequest:(CMISRequest *)cmisRequest + completionBlock:(void (^)(CMISAcl *acl, NSError *error))completionBlock +{ + if (!cmisRequest.isCancelled) { + // build URL + NSString *objectUrl = [self retrieveObjectUrlForObjectWithId:objectId selector:kCMISBrowserJSONSelectorAcl]; + + // prepare form data + CMISBroswerFormDataWriter *formData = [[CMISBroswerFormDataWriter alloc] initWithAction:kCMISBrowserJSONActionApplyAcl]; + [formData addAcesParameters:addAces]; + [formData addRemoveAcesParameters:removeAces]; + [formData addParameter:kCMISParameterAclPropagation value:[CMISEnums stringForAclPropagation:aclPropagation]]; + + // send + [self.bindingSession.networkProvider invokePOST:[NSURL URLWithString:objectUrl] + session:self.bindingSession + body:formData.body + headers:formData.headers + cmisRequest:cmisRequest + completionBlock:^(CMISHttpResponse *httpResponse, NSError *error) { + if ((httpResponse.statusCode == 200 || httpResponse.statusCode == 201) && httpResponse.data) { + [CMISBrowserUtil aclFromJSONData:httpResponse.data completionBlock:^(CMISAcl *acl, NSError *error) { + if (error) { + completionBlock(nil, error); + } else { + completionBlock(acl, nil); + } + }]; + } else { + completionBlock(nil, error); + } + }]; + + } else { + if (completionBlock) { + completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeCancelled + detailedDescription:@"Request was cancelled"]); + } + } + return cmisRequest; +} + +- (CMISRequest*)setAcl:objectId + aces:(CMISAcl *)aces + completionBlock:(void (^)(CMISAcl *acl, NSError *error))completionBlock +{ + __block CMISRequest *cmisRequest = [self retrieveAcl:objectId onlyBasicPermissions:NO completionBlock:^(CMISAcl *currentAcl, NSError *error) { + if (error) { + if (completionBlock) { + completionBlock(nil, error); + } + } else { + NSMutableSet *removeAcesSet = [NSMutableSet new]; + for (CMISAce *ace in currentAcl.aces) { + if (ace.isDirect) { + [removeAcesSet addObject:ace]; + } + } + + CMISAcl *removeAces = [[CMISAcl alloc] init]; + [removeAces setAces:removeAcesSet]; + [self internalApplyAcl:objectId addAces:aces removeAces:removeAces aclPropagation:CMISAclPropagationObjectOnly cmisRequest:cmisRequest completionBlock:completionBlock]; + } + }]; + return cmisRequest; +} + +@end Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserBinding.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserBinding.m?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserBinding.m (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserBinding.m Tue May 16 10:33:32 2017 @@ -24,6 +24,7 @@ #import "CMISBrowserNavigationService.h" #import "CMISBrowserVersioningService.h" #import "CMISBrowserDiscoveryService.h" +#import "CMISBrowserAclService.h" @interface CMISBrowserBinding () @@ -53,6 +54,7 @@ self.navigationService = [[CMISBrowserNavigationService alloc] initWithBindingSession:self.session]; self.versioningService = [[CMISBrowserVersioningService alloc] initWithBindingSession:self.session]; self.discoveryService = [[CMISBrowserDiscoveryService alloc] initWithBindingSession:self.session]; + self.aclService = [[CMISBrowserAclService alloc] initWithBindingSession:self.session]; } return self; } Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserConstants.h URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserConstants.h?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserConstants.h (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserConstants.h Tue May 16 10:33:32 2017 @@ -89,6 +89,7 @@ extern NSString * const kCMISBrowserJSON extern NSString * const kCMISBrowserJSONObject; extern NSString * const kCMISBrowserJSONHasMoreItems; extern NSString * const kCMISBrowserJSONNumberItems; +extern NSString * const kCMISBrowserJSONChangeLogToken; extern NSString * const kCMISBrowserJSONThinClientUri; extern NSString * const kCMISBrowserJSONChangesIncomplete; extern NSString * const kCMISBrowserJSONChangesOnType; @@ -105,6 +106,8 @@ extern NSString * const kCMISBrowserJSON extern NSString * const kCMISBrowserJSONAcePrincipalId; extern NSString * const kCMISBrowserJSONAcePermissions; extern NSString * const kCMISBrowserJSONAceIsDirect; +extern NSString * const kCMISBrowserJSONChangeEventType; +extern NSString * const kCMISBrowserJSONChangeEventTime; // JSON enum values extern NSString * const kCMISBrowserJSONPropertyTypeValueString; @@ -164,6 +167,10 @@ extern NSString * const kCMISBrowserJSON extern NSString * const kCMISBrowserJSONControlCmisAction; extern NSString * const kCMISBrowserJSONControlPropertyId; extern NSString * const kCMISBrowserJSONControlPropertyValue; +extern NSString * const kCMISBrowserJSONControlAddAcePrincipal; +extern NSString * const kCMISBrowserJSONControlAddAcePermission; +extern NSString * const kCMISBrowserJSONControlRemoveAcePrincipal; +extern NSString * const kCMISBrowserJSONControlRemoveAcePermission; // Browser binding actions extern NSString * const kCMISBrowserJSONActionCreateType; @@ -204,5 +211,7 @@ extern NSString * const kCMISBrowserJSON + (NSSet *)aclKeys; + (NSSet *)aceKeys; + (NSSet *)principalKeys; ++ (NSSet *)policyIdsKeys; ++ (NSSet *)changeEventKeys; @end Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserConstants.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserConstants.m?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserConstants.m (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserConstants.m Tue May 16 10:33:32 2017 @@ -30,6 +30,8 @@ static NSSet *_queryResultListKeys; static NSSet *_aclKeys; static NSSet *_aceKeys; static NSSet *_principalKeys; +static NSSet *_policyIdKeys; +static NSSet *_changeEventKeys; @implementation CMISBrowserConstants @@ -118,6 +120,8 @@ NSString * const kCMISBrowserJSONAcePrin NSString * const kCMISBrowserJSONAcePrincipalId = @"principalId"; NSString * const kCMISBrowserJSONAcePermissions = @"permissions"; NSString * const kCMISBrowserJSONAceIsDirect = @"isDirect"; +NSString * const kCMISBrowserJSONChangeEventType = @"changeType"; +NSString * const kCMISBrowserJSONChangeEventTime = @"changeTime"; // JSON enum values @@ -180,6 +184,10 @@ NSString * const kCMISBrowserJSONParamet NSString * const kCMISBrowserJSONControlCmisAction = @"cmisaction"; NSString * const kCMISBrowserJSONControlPropertyId = @"propertyId"; NSString * const kCMISBrowserJSONControlPropertyValue = @"propertyValue"; +NSString * const kCMISBrowserJSONControlAddAcePrincipal = @"addACEPrincipal"; +NSString * const kCMISBrowserJSONControlAddAcePermission = @"addACEPermission"; +NSString * const kCMISBrowserJSONControlRemoveAcePrincipal = @"removeACEPrincipal"; +NSString * const kCMISBrowserJSONControlRemoveAcePermission = @"removeACEPermission"; // Browser binding actions @@ -408,4 +416,25 @@ NSString * const kCMISBrowserJSONActionA return _principalKeys; } ++ (NSSet *)policyIdsKeys +{ + if(!_policyIdKeys) { + _policyIdKeys = [NSSet setWithObjects: + kCMISBrowserJSONPolicyIdsIds, + nil]; + } + return _policyIdKeys; +} + ++ (NSSet *)changeEventKeys +{ + if(!_changeEventKeys) { + _changeEventKeys = [NSSet setWithObjects: + kCMISBrowserJSONChangeEventType, + kCMISBrowserJSONChangeEventTime, + nil]; + } + return _changeEventKeys; +} + @end Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserDiscoveryService.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserDiscoveryService.m?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserDiscoveryService.m (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserDiscoveryService.m Tue May 16 10:33:32 2017 @@ -26,6 +26,8 @@ #import "CMISBrowserConstants.h" #import "CMISConstants.h" #import "CMISEnums.h" +#import "CMISURLUtil.h" +#import "CMISStringInOutParameter.h" @implementation CMISBrowserDiscoveryService @@ -71,6 +73,54 @@ includeAllowableActions:(BOOL)includeAll } else { completionBlock(nil, error); } + }]; + return cmisRequest; +} + +- (CMISRequest *)retrieveContentChanges:(CMISStringInOutParameter *)changeLogTokenParam + includeProperties:(BOOL)includeProperties + filter:(NSString *)filter + includePolicyIds:(BOOL)includePolicyIds + includeAcl:(BOOL)includeAcl + maxItems:(NSNumber *)maxItems + completionBlock:(void (^)(CMISObjectList *, NSError *))completionBlock +{ + // build url + NSString *url = [self retrieveRepositoryUrlWithSelector:kCMISBrowserJSONSelectorContentChanges]; + url = [CMISURLUtil urlStringByAppendingParameter:kCMISParameterChangeLogToken value:changeLogTokenParam.inParameter urlString:url]; + url = [CMISURLUtil urlStringByAppendingParameter:kCMISParameterIncludeProperties boolValue:includeProperties urlString:url]; + url = [CMISURLUtil urlStringByAppendingParameter:kCMISParameterFilter value:filter urlString:url]; + url = [CMISURLUtil urlStringByAppendingParameter:kCMISParameterIncludePolicyIds boolValue:includePolicyIds urlString:url]; + url = [CMISURLUtil urlStringByAppendingParameter:kCMISParameterIncludeAcl boolValue:includeAcl urlString:url]; + url = [CMISURLUtil urlStringByAppendingParameter:kCMISParameterMaxItems numberValue:maxItems urlString:url]; + url = [CMISURLUtil urlStringByAppendingParameter:kCMISBrowserJSONParameterSuccinct value:kCMISParameterValueTrue urlString:url]; + + // read and parse + CMISRequest *cmisRequest = [[CMISRequest alloc] init]; + [self.bindingSession.networkProvider invokeGET:[NSURL URLWithString:url] + session:self.bindingSession + cmisRequest:cmisRequest + completionBlock:^(CMISHttpResponse *httpResponse, NSError *error) { + if (httpResponse.statusCode == 200 && httpResponse.data) { + NSError *parsingError = nil; + NSString *token = [CMISBrowserUtil objectListChangeLogTokenFromJSONData:httpResponse.data error:&parsingError]; + if (parsingError) { + completionBlock(nil, parsingError); + } else { + changeLogTokenParam.outParameter = token; + + CMISBrowserTypeCache *typeCache = [[CMISBrowserTypeCache alloc] initWithRepositoryId:self.bindingSession.repositoryId bindingService:self]; + [CMISBrowserUtil objectListFromJSONData:httpResponse.data typeCache:typeCache isQueryResult:NO completionBlock:^(CMISObjectList *objectList, NSError *objectListParseError) { + if (objectListParseError) { + completionBlock(nil, objectListParseError); + } else { + completionBlock(objectList, nil); + } + }]; + } + } else { + completionBlock(nil, error); + } }]; return cmisRequest; } Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserNavigationService.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserNavigationService.m?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserNavigationService.m (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserNavigationService.m Tue May 16 10:33:32 2017 @@ -24,6 +24,7 @@ #import "CMISBrowserUtil.h" #import "CMISBrowserConstants.h" #import "CMISURLUtil.h" +#import "CMISBrowserTypeCache.h" @implementation CMISBrowserNavigationService Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserObjectService.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserObjectService.m?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserObjectService.m (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserObjectService.m Tue May 16 10:33:32 2017 @@ -29,6 +29,7 @@ #import "CMISLog.h" #import "CMISBroswerFormDataWriter.h" #import "CMISStringInOutParameter.h" +#import "CMISBrowserTypeCache.h" @implementation CMISBrowserObjectService @@ -336,35 +337,47 @@ CMISRequest *cmisRequest = [[CMISRequest alloc] init]; + void (^responseHandlingBlock) (CMISHttpResponse*, NSError*) = ^(CMISHttpResponse *httpResponse, NSError *error) { + if ((httpResponse.statusCode == 200 || httpResponse.statusCode == 201) && httpResponse.data) { + CMISBrowserTypeCache *typeCache = [[CMISBrowserTypeCache alloc] initWithRepositoryId:self.bindingSession.repositoryId bindingService:self]; + [CMISBrowserUtil objectDataFromJSONData:httpResponse.data typeCache:typeCache completionBlock:^(CMISObjectData *objectData, NSError *error) { + if (error) { + completionBlock(error); + } else { + objectId.outParameter = objectData.identifier; + changeToken.outParameter = objectData.properties.propertiesDictionary[kCMISPropertyChangeToken]; + + completionBlock(nil); + } + }]; + } else { + completionBlock(error); + } + }; + // send - [self.bindingSession.networkProvider invoke:[NSURL URLWithString:objectUrl] - httpMethod:HTTP_POST - session:self.bindingSession - inputStream:inputStream - headers:formData.headers - bytesExpected:bytesExpected - cmisRequest:cmisRequest - startData:formData.startData - endData:formData.endData - useBase64Encoding:NO - completionBlock:^(CMISHttpResponse *httpResponse, NSError *error) { - if ((httpResponse.statusCode == 200 || httpResponse.statusCode == 201) && httpResponse.data) { - CMISBrowserTypeCache *typeCache = [[CMISBrowserTypeCache alloc] initWithRepositoryId:self.bindingSession.repositoryId bindingService:self]; - [CMISBrowserUtil objectDataFromJSONData:httpResponse.data typeCache:typeCache completionBlock:^(CMISObjectData *objectData, NSError *error) { - if (error) { - completionBlock(error); - } else { - objectId.outParameter = objectData.identifier; - changeToken.outParameter = objectData.properties.propertiesDictionary[kCMISPropertyChangeToken]; - - completionBlock(nil); - } - }]; - } else { - completionBlock(error); - } - } - progressBlock:progressBlock]; + if (inputStream) { + [self.bindingSession.networkProvider invoke:[NSURL URLWithString:objectUrl] + httpMethod:HTTP_POST + session:self.bindingSession + inputStream:inputStream + headers:formData.headers + bytesExpected:bytesExpected + cmisRequest:cmisRequest + startData:formData.startData + endData:formData.endData + useBase64Encoding:NO + completionBlock:responseHandlingBlock + progressBlock:progressBlock]; + } else { + [self.bindingSession.networkProvider invokePOST:[NSURL URLWithString:objectUrl] + session:self.bindingSession + body:formData.body + headers:formData.headers + cmisRequest:cmisRequest + completionBlock:responseHandlingBlock]; + } + return cmisRequest; } Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserUtil.h URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserUtil.h?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserUtil.h (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserUtil.h Tue May 16 10:33:32 2017 @@ -18,11 +18,13 @@ */ #import <Foundation/Foundation.h> -#import "CMISTypeDefinition.h" -#import "CMISObjectData.h" -#import "CMISObjectList.h" -#import "CMISBindingSession.h" -#import "CMISBrowserTypeCache.h" + +@class CMISObjectData; +@class CMISBindingSession; +@class CMISAcl; +@class CMISObjectList; +@class CMISBrowserTypeCache; +@class CMISTypeDefinition; @interface CMISBrowserUtil : NSObject @@ -61,4 +63,11 @@ */ + (void)objectParents:(NSData *)jsonData typeCache:(CMISBrowserTypeCache *)typeCache completionBlock:(void(^)(NSArray *objectParents, NSError *error))completionBlock; +/** + Returns a CMISAcl object parsed from the given JSON data. + */ ++ (void)aclFromJSONData:(NSData *)jsonData completionBlock:(void(^)(CMISAcl *objectList, NSError *error))completionBlock; + ++ (NSString *)objectListChangeLogTokenFromJSONData:(NSData *)jsonData error:(NSError **)outError; + @end Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserUtil.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserUtil.m?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserUtil.m (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserUtil.m Tue May 16 10:33:32 2017 @@ -36,6 +36,10 @@ #import "CMISAce.h" #import "CMISPrincipal.h" #import "CMISAllowableActions.h" +#import "CMISBrowserTypeCache.h" +#import "CMISObjectList.h" +#import "CMISPolicyIdList.h" +#import "CMISChangeEventInfo.h" NSString * const kCMISBrowserMinValueAlfrescoJSONProperty = @"\"minValue\":0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000049,"; NSString * const kCMISBrowserMinValueECMJSONProperty = @"\"minValue\":-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,"; @@ -368,6 +372,44 @@ NSString * const kCMISBrowserMaxValueECM } } ++(void)aclFromJSONData:(NSData *)jsonData completionBlock:(void (^)(CMISAcl *, NSError *))completionBlock +{ + // TODO: error handling i.e. if jsonData is nil, also handle outError being nil + + // parse the JSON response + NSError *serialisationError = nil; + id jsonDictionary = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&serialisationError]; + + if (!serialisationError) { + BOOL isExactAcl = [jsonDictionary cmis_boolForKey:kCMISBrowserJSONIsExact]; + CMISAcl *acl = [self convertAcl:jsonDictionary isExactAcl:isExactAcl]; + completionBlock(acl, nil); + } else { + completionBlock(nil, [CMISErrors cmisError:serialisationError cmisErrorCode:kCMISErrorCodeRuntime]); + return; + } +} + ++ (NSString *)objectListChangeLogTokenFromJSONData:(NSData *)jsonData error:(NSError *__autoreleasing *)outError +{ + // TODO: error handling i.e. if jsonData is nil, also handle outError being nil + + // parse the JSON response + NSError *serialisationError = nil; + id jsonDictionary = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&serialisationError]; + + NSString *token = nil; + if (!serialisationError) { + // parse the json into a CMISObjectData object + token = [jsonDictionary cmis_objectForKeyNotNull:kCMISBrowserJSONChangeLogToken]; + } else { + if (outError != NULL) *outError = [CMISErrors cmisError:serialisationError cmisErrorCode:kCMISErrorCodeRuntime]; + return nil; + } + + return token; +} + #pragma mark - #pragma mark Private helper methods @@ -405,6 +447,8 @@ NSString * const kCMISBrowserMaxValueECM objectData.baseType = CMISBaseTypeDocument; } else if ([baseType isEqualToString:kCMISPropertyObjectTypeIdValueFolder]) { objectData.baseType = CMISBaseTypeFolder; + } else if ([baseType isEqualToString:kCMISPropertyObjectTypeIdValueItem]) { + objectData.baseType = CMISBaseTypeItem; } BOOL isExactAcl = [dictionary cmis_boolForKey:kCMISBrowserJSONIsExact]; @@ -412,9 +456,20 @@ NSString * const kCMISBrowserMaxValueECM objectData.allowableActions = [CMISBrowserUtil convertAllowableActions:[dictionary cmis_objectForKeyNotNull:kCMISBrowserJSONAllowableActions]]; + NSDictionary *jsonChangeEventInfo = [dictionary cmis_objectForKeyNotNull:kCMISBrowserJSONChangeEventInfo]; + if (jsonChangeEventInfo) { + CMISChangeEventInfo *changeEventInfo = [CMISChangeEventInfo new]; + + changeEventInfo.changeTime = [CMISBrowserUtil convertNumberToDate:[jsonChangeEventInfo cmis_objectForKeyNotNull:kCMISBrowserJSONChangeEventTime]]; + changeEventInfo.changeType = [CMISEnums enumForChangeType:[jsonChangeEventInfo cmis_objectForKeyNotNull:kCMISBrowserJSONChangeEventType]]; + + changeEventInfo.extensions = [CMISObjectConverter convertExtensions:dictionary cmisKeys:[CMISBrowserConstants changeEventKeys]]; + + objectData.changeEventInfo = changeEventInfo; + } + objectData.isExactAcl = isExactAcl; - - // TODO set policyIds + objectData.policyIds = [CMISBrowserUtil convertPolicyIds:[dictionary cmis_objectForKeyNotNull:kCMISBrowserJSONPolicyIds]]; NSDictionary *propertiesExtension = [dictionary cmis_objectForKeyNotNull:kCMISBrowserJSONPropertiesExtension]; @@ -652,6 +707,16 @@ NSString * const kCMISBrowserMaxValueECM id propValue = [propertiesJson cmis_objectForKeyNotNull:propName]; NSArray *values = nil; if ([propValue isKindOfClass:NSArray.class]) { + // validate array, it must not contain null elements + for (id value in propValue) { + if (value == [NSNull null]) { + NSError *error = [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument + detailedDescription:[NSString stringWithFormat:@"Array of property %@ contains null elements!", propName]]; + completionBlock(nil, error); + return; + } + } + values = propValue; } else if (propValue) { values = [NSArray arrayWithObject:propValue]; @@ -678,7 +743,7 @@ NSString * const kCMISBrowserMaxValueECM } default: { NSError *error = [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument - detailedDescription:@"Unknown property type!"]; + detailedDescription:[NSString stringWithFormat:@"Unknown property type of property %@!", propName]]; completionBlock(nil, error); return; } @@ -753,6 +818,14 @@ NSString * const kCMISBrowserMaxValueECM return dates; } ++ (NSDate *)convertNumberToDate:(NSNumber *)miliseconds +{ + if (!miliseconds) { + return nil; + } + return [NSDate dateWithTimeIntervalSince1970:[miliseconds unsignedLongLongValue] / 1000.0]; // miliseconds to seconds +} + + (void)convertProperties:(NSArray*)propNames position:(NSInteger)position properties:(CMISProperties *)properties propertiesJson:(NSDictionary *)propertiesJson typeCache:(CMISBrowserTypeCache *)typeCache typeDefinition:(CMISTypeDefinition *)typeDef secondaryTypeDefinitions:(NSArray *)secTypeDefs completionBlock:(void (^)(CMISProperties *properties, NSError *error))completionBlock { NSString *propName = [propNames objectAtIndex:position]; @@ -888,6 +961,32 @@ NSString * const kCMISBrowserMaxValueECM return result; } + ++ (CMISPolicyIdList *)convertPolicyIds:(NSDictionary *)jsonDictionary +{ + if (!jsonDictionary) { + return nil; + } + + CMISPolicyIdList *result = [CMISPolicyIdList new]; + NSMutableArray *policyIds = [NSMutableArray new]; + + NSArray *ids = [jsonDictionary cmis_objectForKeyNotNull:kCMISBrowserJSONPolicyIdsIds]; + + if (ids && [ids isKindOfClass:NSArray.class]) { + for (id obj in ids) { + if ([obj isKindOfClass:NSString.class]) { + [policyIds addObject:obj]; + } + } + } + + result.extensions = [CMISObjectConverter convertExtensions:jsonDictionary cmisKeys:[CMISBrowserConstants policyIdsKeys]]; + + result.policyIds = [policyIds copy]; + + return result; +} + (CMISAllowableActions *)convertAllowableActions:(NSDictionary *)jsonDictionary { Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserVersioningService.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserVersioningService.m?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserVersioningService.m (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/Browser/CMISBrowserVersioningService.m Tue May 16 10:33:32 2017 @@ -28,6 +28,8 @@ #import "CMISBroswerFormDataWriter.h" #import "CMISFileUtil.h" #import "CMISLog.h" +#import "CMISBrowserTypeCache.h" +#import "CMISObjectList.h" @implementation CMISBrowserVersioningService Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISAclService.h URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISAclService.h?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISAclService.h (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISAclService.h Tue May 16 10:33:32 2017 @@ -18,7 +18,38 @@ */ #import <Foundation/Foundation.h> +#import "CMISEnums.h" + +@class CMISExtensionData; +@class CMISAcl; +@class CMISRequest; @protocol CMISAclService <NSObject> +/** + * Retrieves the acl of an object with the given object identifier. + * completionBlock returns acl for an object or nil if unsuccessful + */ +- (CMISRequest*)retrieveAcl:objectId + onlyBasicPermissions:(BOOL)onlyBasicPermissions + completionBlock:(void (^)(CMISAcl *acl, NSError *error))completionBlock; + +/** + * Removes and adds the specified acl to an object with the given object identifier. + * completionBlock returns acl for an object or nil if unsuccessful + */ +- (CMISRequest*)applyAcl:objectId + addAces:(CMISAcl *)addAces + removeAces:(CMISAcl *)removeAces + aclPropagation:(CMISAclPropagation)aclPropagation + completionBlock:(void (^)(CMISAcl *acl, NSError *error))completionBlock; + +/** + * Sets the specified acl to an object with the given object identifier. + * completionBlock returns acl for an object or nil if unsuccessful + */ +- (CMISRequest*)setAcl:objectId + aces:(CMISAcl *)aces + completionBlock:(void (^)(CMISAcl *acl, NSError *error))completionBlock; + @end Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISBindingSession.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISBindingSession.m?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISBindingSession.m (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISBindingSession.m Tue May 16 10:33:32 2017 @@ -57,7 +57,12 @@ NSString * const kCMISBindingSessionKeyU [self.sessionData setObject:[sessionParameters objectForKey:key] forKey:key]; } - //set type definition cache after other data stored in the dictionary as the cache size is retrieved from the sessionData in the init method of the CMISTypeDefinitionCache + // set session to authentication provider after other data stored in the dictionary as the authentication provider might access the sessionData within the setSession method + if ([self.authenticationProvider respondsToSelector:@selector(setSession:)]) { + [self.authenticationProvider setSession:self]; + } + + // set type definition cache after other data stored in the dictionary as the cache size is retrieved from the sessionData in the init method of the CMISTypeDefinitionCache if(sessionParameters.typeDefinitionCache == nil) { self.typeDefinitionCache = [[CMISTypeDefinitionCache alloc] initWithBindingSession:self]; } else { Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEvent.h URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEvent.h?rev=1795295&view=auto ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEvent.h (added) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEvent.h Tue May 16 10:33:32 2017 @@ -0,0 +1,49 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +#import <Foundation/Foundation.h> +#import "CMISChangeEventInfo.h" + +@class CMISAcl; + +/** + * Change event in the change log. + */ +@interface CMISChangeEvent : CMISChangeEventInfo + +/** + * object ID, not nil. + */ +@property (nonatomic, strong) NSString *objectId; + +/** + * Dictionary of NSString : NSArray objects. + */ +@property (nonatomic, strong)NSDictionary *properties; + +/** + * NSArray of NSString, representing the policy IDs. + */ +@property (nonatomic, strong) NSArray *policyIds; + +@property (nonatomic, strong) CMISAcl *acl; + + + +@end Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEvent.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEvent.m?rev=1795295&view=auto ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEvent.m (added) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEvent.m Tue May 16 10:33:32 2017 @@ -0,0 +1,24 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +#import "CMISChangeEvent.h" + +@implementation CMISChangeEvent + +@end Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEventInfo.h URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEventInfo.h?rev=1795295&view=auto ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEventInfo.h (added) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEventInfo.h Tue May 16 10:33:32 2017 @@ -0,0 +1,38 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +#import "CMISExtensionData.h" +#import "CMISEnums.h" + +/** + * Class to hold the basic change event. + */ +@interface CMISChangeEventInfo : CMISExtensionData + +/** + * Change event type, not nil + */ +@property (nonatomic, assign) CMISChangeType changeType; + +/** + * Timestamp when the change took place, not nil + */ +@property (nonatomic, strong) NSDate *changeTime; + +@end Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEventInfo.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEventInfo.m?rev=1795295&view=auto ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEventInfo.m (added) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEventInfo.m Tue May 16 10:33:32 2017 @@ -0,0 +1,24 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +#import "CMISChangeEventInfo.h" + +@implementation CMISChangeEventInfo + +@end Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEvents.h URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEvents.h?rev=1795295&view=auto ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEvents.h (added) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEvents.h Tue May 16 10:33:32 2017 @@ -0,0 +1,52 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +#import <Foundation/Foundation.h> + +/** + * Class to hold the change event list. + */ +@interface CMISChangeEvents : NSObject + +/** + * Change log token if available. + */ +@property (nonatomic, strong) NSString *latestChangeLogToken; + +/** + * Array of CMISChangeEvent objects. + */ +@property (nonatomic, strong) NSArray *changeEvents; + +/** + * TRUE if there are more change events after those contained in the response. + * FALSE otherwise. If TRUE, a request with a larger maxItems is expected + * to return additional results. + */ +@property BOOL hasMoreItems; + +/** + * If the repository knows the total number of change event items in a result set, the repository SHOULD include the number here. + * If the repository does not know the number of items in a result set, this parameter SHOULD not be set. + * The value in the parameter MAY NOT be accurate the next time the client retrieves the result set + * or the next page in the result set. + */ +@property int numItems; + +@end Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEvents.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEvents.m?rev=1795295&view=auto ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEvents.m (added) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISChangeEvents.m Tue May 16 10:33:32 2017 @@ -0,0 +1,24 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +#import "CMISChangeEvents.h" + +@implementation CMISChangeEvents + +@end Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISDiscoveryService.h URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISDiscoveryService.h?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISDiscoveryService.h (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISDiscoveryService.h Tue May 16 10:33:32 2017 @@ -22,14 +22,15 @@ @class CMISObjectList; @class CMISRequest; +@class CMISStringInOutParameter; @protocol CMISDiscoveryService <NSObject> /** * (optional) Integer maxItems: This is the maximum number of items to return in a response. * The repository MUST NOT exceed this maximum. Default is repository-specific. -(optional) Integer skipCount: This is the number of potential results that the repository MUST skip/page over - before returning any results. Defaults to 0. +* (optional) Integer skipCount: This is the number of potential results that the repository MUST skip/page over +* before returning any results. Defaults to 0. */ /** launches a query on the server with the parameters specified * completionBlock returns the found object list or nil if unsuccessful @@ -42,4 +43,19 @@ skipCount:(NSNumber *)skipCount completionBlock:(void (^)(CMISObjectList *objectList, NSError *error))completionBlock; +/** + * (optional) Integer maxItems: This is the maximum number of items to return in a response. + * The repository MUST NOT exceed this maximum. Default is repository-specific. + */ +/** Returns the content changes. + * completionBlock returns the found object list or nil if unsuccessful + */ +- (CMISRequest*)retrieveContentChanges:(CMISStringInOutParameter *)changeLogTokenParam + includeProperties:(BOOL)includeProperties + filter:(NSString *)filter + includePolicyIds:(BOOL)includePolicyIds + includeAcl:(BOOL)includeAcl + maxItems:(NSNumber *)maxItems + completionBlock:(void (^)(CMISObjectList *objectList, NSError *error))completionBlock; + @end Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISPolicyIdList.h URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISPolicyIdList.h?rev=1795295&view=auto ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISPolicyIdList.h (added) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISPolicyIdList.h Tue May 16 10:33:32 2017 @@ -0,0 +1,32 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +#import "CMISExtensionData.h" + +/** + * Class to hold the policy IDs + */ +@interface CMISPolicyIdList : CMISExtensionData + +/** + * policy IDs, not nil. + */ +@property (nonatomic, strong) NSArray *policyIds; + +@end Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISPolicyIdList.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISPolicyIdList.m?rev=1795295&view=auto ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISPolicyIdList.m (added) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISPolicyIdList.m Tue May 16 10:33:32 2017 @@ -0,0 +1,24 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +#import "CMISPolicyIdList.h" + +@implementation CMISPolicyIdList + +@end Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISQueryStatement.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISQueryStatement.m?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISQueryStatement.m (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Bindings/CMISQueryStatement.m Tue May 16 10:33:32 2017 @@ -214,11 +214,15 @@ static NSDateFormatter *cmisQueryStateme if (!cmisQueryStatementTimeStampFormatter) { cmisQueryStatementTimeStampFormatter = [[NSDateFormatter alloc] init]; cmisQueryStatementTimeStampFormatter.dateFormat = @"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; - cmisQueryStatementTimeStampFormatter.calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; + cmisQueryStatementTimeStampFormatter.calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; cmisQueryStatementTimeStampFormatter.timeZone = [NSTimeZone timeZoneWithName:@"GMT"]; } return [cmisQueryStatementTimeStampFormatter stringFromDate:date]; } +-(NSString *)description { + return self.queryString; +} + @end Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISItem.h URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISItem.h?rev=1795295&view=auto ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISItem.h (added) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISItem.h Tue May 16 10:33:32 2017 @@ -0,0 +1,25 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + + +#import "CMISFileableObject.h" + +@interface CMISItem : CMISFileableObject + +@end Added: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISItem.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISItem.m?rev=1795295&view=auto ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISItem.m (added) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISItem.m Tue May 16 10:33:32 2017 @@ -0,0 +1,24 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +#import "CMISItem.h" + +@implementation CMISItem + +@end Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.h URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.h?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.h (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.h Tue May 16 10:33:32 2017 @@ -68,5 +68,28 @@ */ - (NSArray *)extensionsForExtensionLevel:(CMISExtensionLevel)extensionLevel; +/** + * Retrieves the acl of an object with the given object identifier. + * completionBlock returns acl for an object or nil if unsuccessful + */ +- (CMISRequest*)retrieveAclOnlyBasicPermissions:(BOOL)onlyBasicPermissions + completionBlock:(void (^)(CMISAcl *acl, NSError *error))completionBlock; + +/** + * Removes and adds the specified acl to an object with the given object identifier. + * completionBlock returns acl for an object or nil if unsuccessful + */ +- (CMISRequest*)applyAclAddAces:(CMISAcl *)addAces + removeAces:(CMISAcl *)removeAces + aclPropagation:(CMISAclPropagation)aclPropagation + completionBlock:(void (^)(CMISAcl *acl, NSError *error))completionBlock; + +/** + * Sets the specified acl to an object with the given object identifier. + * completionBlock returns acl for an object or nil if unsuccessful + */ +- (CMISRequest*)setAcl:(CMISAcl *)aces + completionBlock:(void (^)(CMISAcl *acl, NSError *error))completionBlock; + @end Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.m URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.m?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.m (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISObject.m Tue May 16 10:33:32 2017 @@ -26,6 +26,8 @@ #import "CMISRenditionData.h" #import "CMISRendition.h" #import "CMISLog.h" +#import "CMISPolicyIdList.h" +#import "CMISChangeEventInfo.h" @interface CMISObject () @@ -74,12 +76,15 @@ self.allowableActions = objectData.allowableActions; self.acl = objectData.acl; + // TODO handle policies (lazy loading) + // Extract Extensions and store in the extensionsDict self.extensionsDict = [[NSMutableDictionary alloc] init]; - [self.extensionsDict setObject:[self nonNilArray:objectData.extensions] forKey:[NSNumber numberWithInteger:CMISExtensionLevelObject]]; - [self.extensionsDict setObject:[self nonNilArray:self.properties.extensions] forKey:[NSNumber numberWithInteger:CMISExtensionLevelProperties]]; - [self.extensionsDict setObject:[self nonNilArray:self.allowableActions.extensions] forKey:[NSNumber numberWithInteger:CMISExtensionLevelAllowableActions]]; - [self.extensionsDict setObject:[self nonNilArray:self.acl.extensions] forKey:[NSNumber numberWithInteger:CMISExtensionLevelAcl]]; + [self.extensionsDict setObject:[self nonNilArray:objectData.extensions] forKey:@(CMISExtensionLevelObject)]; + [self.extensionsDict setObject:[self nonNilArray:self.properties.extensions] forKey:@(CMISExtensionLevelProperties)]; + [self.extensionsDict setObject:[self nonNilArray:self.allowableActions.extensions] forKey:@(CMISExtensionLevelAllowableActions)]; + [self.extensionsDict setObject:[self nonNilArray:self.acl.extensions] forKey:@(CMISExtensionLevelAcl)]; + [self.extensionsDict setObject:[self nonNilArray:objectData.policyIds.extensions] forKey:@(CMISExtensionLevelPolicies)]; // Renditions must be converted here, because they need access to the session if (objectData.renditions != nil) { @@ -162,4 +167,49 @@ return [self.extensionsDict objectForKey:[NSNumber numberWithInteger:extensionLevel]]; } +-(CMISRequest *)retrieveAclOnlyBasicPermissions:(BOOL)onlyBasicPermissions completionBlock:(void (^)(CMISAcl *, NSError *))completionBlock +{ + return [self.session retrieveAclFromCMISObject:self.identifier onlyBasicPermissions:onlyBasicPermissions completionBlock:^(CMISAcl *acl, NSError *error) { + if (error) { + if (completionBlock) { + completionBlock(nil, [CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeRuntime]); + } + } else { + if (completionBlock) { + completionBlock(acl, nil); + } + } + }]; +} + +-(CMISRequest *)applyAclAddAces:(CMISAcl *)addAces removeAces:(CMISAcl *)removeAces aclPropagation:(CMISAclPropagation)aclPropagation completionBlock:(void (^)(CMISAcl *, NSError *))completionBlock +{ + return [self.session applyAclToCMISObject:self.identifier addAces:addAces removeAces:removeAces aclPropagation:aclPropagation completionBlock:^(CMISAcl *acl, NSError *error) { + if (error) { + if (completionBlock) { + completionBlock(nil, [CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeRuntime]); + } + } else { + if (completionBlock) { + completionBlock(acl, nil); + } + } + }]; +} + +-(CMISRequest *)setAcl:(CMISAcl *)aces completionBlock:(void (^)(CMISAcl *, NSError *))completionBlock +{ + return [self.session setAclOnCMISObject:self.identifier aces:aces completionBlock:^(CMISAcl *acl, NSError *error) { + if (error) { + if (completionBlock) { + completionBlock(nil, [CMISErrors cmisError:error cmisErrorCode:kCMISErrorCodeRuntime]); + } + } else { + if (completionBlock) { + completionBlock(acl, nil); + } + } + }]; +} + @end Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h URL: http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h?rev=1795295&r1=1795294&r2=1795295&view=diff ============================================================================== --- chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h (original) +++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Client/CMISSession.h Tue May 16 10:33:32 2017 @@ -28,6 +28,7 @@ @class CMISPagedResult; @class CMISTypeDefinition; @class CMISObjectConverter; +@class CMISChangeEvents; @interface CMISSession : NSObject @@ -276,4 +277,51 @@ bytesExpected:(unsigned long long)bytesExpected completionBlock:(void (^)(NSString *objectId, NSError *error))completionBlock progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock; + +/** + * Retrieves the acl of an object with the given object identifier. + * completionBlock returns acl for an object or nil if unsuccessful + */ +- (CMISRequest*)retrieveAclFromCMISObject:objectId + onlyBasicPermissions:(BOOL)onlyBasicPermissions + completionBlock:(void (^)(CMISAcl *acl, NSError *error))completionBlock; + +/** + * Removes and adds the specified acl to an object with the given object identifier. + * completionBlock returns acl for an object or nil if unsuccessful + */ +- (CMISRequest*)applyAclToCMISObject:objectId + addAces:(CMISAcl *)addAces + removeAces:(CMISAcl *)removeAces + aclPropagation:(CMISAclPropagation)aclPropagation + completionBlock:(void (^)(CMISAcl *acl, NSError *error))completionBlock; + +/** + * Sets the specified acl to an object with the given object identifier. + * completionBlock returns acl for an object or nil if unsuccessful + */ +- (CMISRequest*)setAclOnCMISObject:objectId + aces:(CMISAcl *)aces + completionBlock:(void (^)(CMISAcl *acl, NSError *error))completionBlock; + +/** + * Retrieves the content changes. + * completionBlock returns change events or nil if unsuccessful + */ +- (CMISRequest*)retrieveContentChangesWithChangeLogToken:(NSString *)changeLogToken + includeProperties:(BOOL)includeProperties + maxItems:(NSNumber *)maxItems + operationContext:(CMISOperationContext *)operationContext + completionBlock:(void (^)(CMISChangeEvents *changeEvents, NSError *error))completionBlock; + +/** + * Returns a paged result set, containing CMISChangeEvent instances. + * completionBlock returns the content changes, starting from the given change log token to + * the latest entry in the change log as a paged results object or nil if unsuccessful. + */ +- (CMISRequest*)retrieveContentChangesWithChangeLogToken:(NSString *)changeLogToken + includeProperties:(BOOL)includeProperties + operationContext:(CMISOperationContext *)operationContext + completionBlock:(void (^)(CMISPagedResult *result, NSError *error))completionBlock; + @end
