Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature/sharing-ng] Support for new ocis spaces/sharing capabilities #135

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
b7f2299
- OCConnection+GraphAPI: add new GraphAPI endpoints for users and groups
felix-schwarz Dec 10, 2024
e6ec003
- GAGraphContext: first implementation, providing control over strict…
felix-schwarz Dec 10, 2024
03e8dbd
- OCDrive: correct error in commments
felix-schwarz Dec 10, 2024
aba7217
- OCConnection: add new OCConnectionEndpointIDGraphDrivePermissions e…
felix-schwarz Dec 19, 2024
ce0be9d
- OCConnection+GraphAPI + OCShare+GraphAPI: improve handling of drive…
felix-schwarz Dec 19, 2024
9483e36
- OCSharePermission: add localizedDriveRoleName accessors to return j…
felix-schwarz Dec 20, 2024
3f49996
- OCCapabilities: add missing @dynamic lines and additional propertie…
felix-schwarz Dec 23, 2024
2160b5c
- remove unused ManualTypes (from before ocapigen)
felix-schwarz Dec 28, 2024
9802f28
- OCConnection+GraphAPI: expand retrievePermissions from DriveID-only…
felix-schwarz Dec 29, 2024
9952e7d
- OCConnection+Sharing:
felix-schwarz Dec 30, 2024
c9df1b1
- OCShareRole: add hard-coded default symbols based on UUID based on …
felix-schwarz Jan 8, 2025
05fbb83
- OCConnection+GraphAPI:
felix-schwarz Jan 8, 2025
0365b64
- OCUser: ignore empty gaUser.onPremisesSamAccountName values to avoi…
felix-schwarz Jan 10, 2025
199db4c
- OCConnection.h: cleanup
felix-schwarz Feb 4, 2025
14d3c93
- OCConnection+Spaces: add correct entity class to avoid "unknown for…
felix-schwarz Feb 4, 2025
d45f7d3
- OCUserPermissions: new object serving as an abstract interface to d…
felix-schwarz Feb 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 158 additions & 10 deletions ownCloudSDK.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions ownCloudSDK/Connection/Capabilities/OCCapabilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ typedef NSNumber* OCCapabilityBool;
#pragma mark - Spaces
@property(readonly,nullable,nonatomic) OCCapabilityBool spacesEnabled;
@property(readonly,nullable,nonatomic) NSString *spacesVersion;
@property(readonly,nullable,nonatomic) OCCapabilityBool spacesProjects;
@property(readonly,nullable,nonatomic) OCCapabilityBool spacesShareJail;

#pragma mark - Password Policy
@property(readonly,nonatomic) BOOL passwordPolicyEnabled;
Expand Down
30 changes: 30 additions & 0 deletions ownCloudSDK/Connection/Capabilities/OCCapabilities.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,26 @@ @implementation OCCapabilities
@dynamic davReports;
@dynamic davPropfindSupportsDepthInfinity;

#pragma mark - Spaces
@dynamic spacesEnabled;
@dynamic spacesVersion;
@dynamic spacesProjects;
@dynamic spacesShareJail;

#pragma mark - Password Policy
@dynamic passwordPolicyEnabled;
@dynamic passwordPolicyMinCharacters;
@dynamic passwordPolicyMaxCharacters;
@dynamic passwordPolicyMinLowerCaseCharacters;
@dynamic passwordPolicyMinUpperCaseCharacters;
@dynamic passwordPolicyMinDigits;
@dynamic passwordPolicyMinSpecialCharacters;
@dynamic passwordPolicySpecialCharacters;

#pragma mark - App Providers
@dynamic appProviders;
@dynamic latestSupportedAppProvider;

#pragma mark - TUS
@dynamic tusSupported;
@dynamic tusCapabilities;
Expand Down Expand Up @@ -276,6 +296,16 @@ - (NSString *)spacesVersion
return (OCTypedCast(_capabilities[@"spaces"][@"version"], NSString));
}

- (OCCapabilityBool)spacesProjects
{
return (OCTypedCast(_capabilities[@"spaces"][@"projects"], NSNumber));
}

- (OCCapabilityBool)spacesShareJail
{
return (OCTypedCast(_capabilities[@"spaces"][@"share_jail"], NSNumber));
}

#pragma mark - Password Policy
- (NSDictionary<NSString *, id> *)_passwordPolicy
{
Expand Down
26 changes: 25 additions & 1 deletion ownCloudSDK/Connection/GraphAPI/OCConnection+GraphAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,50 @@
*/

#import "OCConnection.h"
#import "GAUnifiedRoleDefinition.h"

NS_ASSUME_NONNULL_BEGIN

@class OCDrive;

typedef void(^OCRetrieveDriveListCompletionHandler)(NSError * _Nullable error, NSArray<OCDrive *> * _Nullable drives);
typedef void(^OCRetrieveLoggedInGraphUserCompletionHandler)(NSError * _Nullable error, OCUser * _Nullable user);
typedef void(^OCRetrieveRoleDefinitionsCompletionHandler)(NSError * _Nullable error, NSArray<OCShareRole *> * _Nullable shareRoles);
typedef void(^OCRetrieveUserPermissionsCompletionHandler)(NSError * _Nullable error, OCUserPermissions * _Nullable userPermissions);

@interface OCConnection (GraphAPI)

#pragma mark - User Info
- (nullable NSProgress *)retrieveLoggedInGraphUserWithCompletionHandler:(OCRetrieveLoggedInGraphUserCompletionHandler)completionHandler;
- (nullable NSProgress *)retrievePermissionsListForUser:(OCUser *)user withCompletionHandler:(OCRetrieveUserPermissionsCompletionHandler)completionHandler;

#pragma mark - Drives
@property(strong,nullable) NSArray<OCDrive *> *drives; //!< Current list of known drives
@property(strong,nullable,nonatomic) NSArray<OCDrive *> *drives; //!< Current list of known drives
@property(strong,nullable,nonatomic) NSArray<OCShareRole *> *globalShareRoles; //!< Global list of share roles

- (nullable OCDrive *)driveWithID:(OCDriveID)driveID; //!< Returns the OCDrive instance for the provided ID if it is already known locally
- (void)driveWithID:(OCDriveID)driveID completionHandler:(void(^)(OCDrive * _Nullable drive))completionHandler; //!< Returns the OCDrive instance for the provided ID. Will attempt to retrieve it from the server if not known locally.

- (nullable NSProgress *)retrieveDriveListWithCompletionHandler:(OCRetrieveDriveListCompletionHandler)completionHandler; //!< Retrieves a list of drives and updates .drives

#pragma mark - Permissions
- (NSURL *)permissionsURLForDriveWithID:(OCDriveID)driveID fileID:(nullable OCFileID)fileID permissionID:(nullable OCShareID)shareID; //!< Returns the API URL for the provided driveID [+ fileID [+ shareID]]

- (nullable NSProgress *)retrievePermissionsForLocation:(OCLocation *)location completionHandler:(OCConnectionShareRetrievalCompletionHandler)completionHandler; //!< Retrieves the permissions for a drive and returns them as OCShares. The original GAPermission objects remain available as OCShare.originGAPermission but should only be used for debugging. The passed location must contain a fileID when not querying a root path

- (nullable NSArray<OCShareActionID> *)shareActionsForDrive:(OCDrive *)drive; //!< Return all allowed share actions composed from the user's role(s) and group role(s) the user is a member of

#pragma mark - Share Rolees
- (nullable NSProgress *)retrieveRoleDefinitionsWithCompletionHandler:(nullable OCRetrieveRoleDefinitionsCompletionHandler)completionHandler; //!< Retrieves the global list of all role definitions from the server

@end

extern OCConnectionEndpointID OCConnectionEndpointIDGraphMe;
extern OCConnectionEndpointID OCConnectionEndpointIDGraphMeDrives;
extern OCConnectionEndpointID OCConnectionEndpointIDGraphDrives;
extern OCConnectionEndpointID OCConnectionEndpointIDGraphDrivePermissions;
extern OCConnectionEndpointID OCConnectionEndpointIDGraphRoleDefinitions;
extern OCConnectionEndpointID OCConnectionEndpointIDGraphUsers;
extern OCConnectionEndpointID OCConnectionEndpointIDGraphGroups;

NS_ASSUME_NONNULL_END
Loading