Skip to content

Commit

Permalink
- OCCore+Sharing: change hardcoded share roles to not include (re)sha…
Browse files Browse the repository at this point in the history
…ring permissions for ocis systems

- fixes owncloud/ios-app#1375
- update Localizable.xcstrings to correct auto-generated "stale" status for alternative role description strings
  • Loading branch information
felix-schwarz authored and hosy committed Sep 11, 2024
1 parent c1f7adc commit f0c6f8f
Show file tree
Hide file tree
Showing 2 changed files with 24,263 additions and 24,259 deletions.
71 changes: 36 additions & 35 deletions ownCloudSDK/Core/Sharing/OCCore+Sharing.m
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ - (nullable NSProgress *)makeDecisionOnShare:(OCShare *)share accept:(BOOL)accep
NSArray<OCShareRole *> *roles = nil;
OCLocationType locationType = location.type;
OCShareTypesMask shareTypeMask = [OCShare maskForType:shareType];
BOOL resharingSupported = !self.useDrives;

if (locationType == OCLocationTypeUnknown)
{
Expand All @@ -383,12 +384,12 @@ - (nullable NSProgress *)makeDecisionOnShare:(OCShare *)share accept:(BOOL)accep
// - files, folders
[[OCShareRole alloc] initWithType:OCShareRoleTypeViewer
shareTypes:OCShareTypesMaskUserShare|OCShareTypesMaskGroupShare
permissions:OCSharePermissionsMaskRead|OCSharePermissionsMaskShare
permissions:OCSharePermissionsMaskRead|(resharingSupported ? OCSharePermissionsMaskShare : 0)
customizablePermissions:OCSharePermissionsMaskNone
locations:OCLocationTypeFile|OCLocationTypeFolder
symbolName:@"eye.fill"
localizedName:OCLocalizedString(@"Viewer",nil)
localizedDescription:OCLocalizedString(@"Download, preview and share",nil)],
localizedDescription:OCLocalizedString(resharingSupported ? @"Download, preview and share" : @"Download and preview", nil)],

// - drives
[[OCShareRole alloc] initWithType:OCShareRoleTypeViewer
Expand All @@ -397,29 +398,29 @@ - (nullable NSProgress *)makeDecisionOnShare:(OCShare *)share accept:(BOOL)accep
customizablePermissions:OCSharePermissionsMaskNone
locations:OCLocationTypeDrive
symbolName:@"eye.fill"
localizedName:OCLocalizedString(@"Viewer",nil)
localizedDescription:OCLocalizedString(@"Download and preview",nil)],
localizedName:OCLocalizedString(@"Viewer", nil)
localizedDescription:OCLocalizedString(@"Download and preview", nil)],

// ## Editor
// - files
[[OCShareRole alloc] initWithType:OCShareRoleTypeEditor
shareTypes:OCShareTypesMaskUserShare|OCShareTypesMaskGroupShare
permissions:OCSharePermissionsMaskRead|OCSharePermissionsMaskUpdate|OCSharePermissionsMaskShare
permissions:OCSharePermissionsMaskRead|OCSharePermissionsMaskUpdate|(resharingSupported ? OCSharePermissionsMaskShare : 0)
customizablePermissions:OCSharePermissionsMaskNone
locations:OCLocationTypeFile
symbolName:@"pencil"
localizedName:OCLocalizedString(@"Editor",nil)
localizedDescription:OCLocalizedString(@"Edit, download, preview and share",nil)],
localizedName:OCLocalizedString(@"Editor", nil)
localizedDescription:OCLocalizedString(resharingSupported ? @"Edit, download, preview and share" : @"Edit, download and preview", nil)],

// - folders
[[OCShareRole alloc] initWithType:OCShareRoleTypeEditor
shareTypes:OCShareTypesMaskUserShare|OCShareTypesMaskGroupShare
permissions:OCSharePermissionsMaskRead|OCSharePermissionsMaskUpdate|OCSharePermissionsMaskCreate|OCSharePermissionsMaskDelete|OCSharePermissionsMaskShare
permissions:OCSharePermissionsMaskRead|OCSharePermissionsMaskUpdate|OCSharePermissionsMaskCreate|OCSharePermissionsMaskDelete|(resharingSupported ? OCSharePermissionsMaskShare : 0)
customizablePermissions:OCSharePermissionsMaskNone
locations:OCLocationTypeFolder
symbolName:@"pencil"
localizedName:OCLocalizedString(@"Editor",nil)
localizedDescription:OCLocalizedString(@"Upload, edit, delete, download, preview and share",nil)],
localizedName:OCLocalizedString(@"Editor", nil)
localizedDescription:OCLocalizedString(resharingSupported ? @"Upload, edit, delete, download, preview and share" : @"Upload, edit, delete, download and preview",nil)],

// - drives
[[OCShareRole alloc] initWithType:OCShareRoleTypeEditor
Expand All @@ -428,40 +429,40 @@ - (nullable NSProgress *)makeDecisionOnShare:(OCShare *)share accept:(BOOL)accep
customizablePermissions:OCSharePermissionsMaskNone
locations:OCLocationTypeDrive
symbolName:@"pencil"
localizedName:OCLocalizedString(@"Editor",nil)
localizedDescription:OCLocalizedString(@"Upload, edit, delete, download and preview",nil)],
localizedName:OCLocalizedString(@"Editor", nil)
localizedDescription:OCLocalizedString(@"Upload, edit, delete, download and preview", nil)],

// ## Manager
// - drives
[[OCShareRole alloc] initWithType:OCShareRoleTypeManager
shareTypes:OCShareTypesMaskUserShare|OCShareTypesMaskGroupShare
permissions:OCSharePermissionsMaskRead|OCSharePermissionsMaskUpdate|OCSharePermissionsMaskCreate|OCSharePermissionsMaskDelete|OCSharePermissionsMaskShare
permissions:OCSharePermissionsMaskRead|OCSharePermissionsMaskUpdate|OCSharePermissionsMaskCreate|OCSharePermissionsMaskDelete|(resharingSupported ? OCSharePermissionsMaskShare : 0)
customizablePermissions:OCSharePermissionsMaskNone
locations:OCLocationTypeDrive
symbolName:@"person.fill"
localizedName:OCLocalizedString(@"Manager",nil)
localizedDescription:OCLocalizedString(@"Upload, edit, delete, download, preview and share",nil)],
localizedName:OCLocalizedString(@"Manager", nil)
localizedDescription:OCLocalizedString(resharingSupported ? @"Upload, edit, delete, download, preview and share" : @"Upload, edit, delete, download and preview", nil)],

// ## Custom
// - files
[[OCShareRole alloc] initWithType:OCShareRoleTypeCustom
shareTypes:OCShareTypesMaskUserShare|OCShareTypesMaskGroupShare
permissions:OCSharePermissionsMaskRead|OCSharePermissionsMaskUpdate|OCSharePermissionsMaskShare
customizablePermissions:OCSharePermissionsMaskUpdate|OCSharePermissionsMaskShare
permissions:OCSharePermissionsMaskRead|OCSharePermissionsMaskUpdate|(resharingSupported ? OCSharePermissionsMaskShare : 0)
customizablePermissions:OCSharePermissionsMaskUpdate|(resharingSupported ? OCSharePermissionsMaskShare : 0)
locations:OCLocationTypeFile
symbolName:@"gearshape.fill"
localizedName:OCLocalizedString(@"Custom",nil)
localizedDescription:OCLocalizedString(@"Set detailed permissions",nil)],
localizedName:OCLocalizedString(@"Custom", nil)
localizedDescription:OCLocalizedString(@"Set detailed permissions", nil)],

// - folders, drives
[[OCShareRole alloc] initWithType:OCShareRoleTypeCustom
shareTypes:OCShareTypesMaskUserShare|OCShareTypesMaskGroupShare
permissions:OCSharePermissionsMaskRead|OCSharePermissionsMaskUpdate|OCSharePermissionsMaskCreate|OCSharePermissionsMaskDelete|OCSharePermissionsMaskShare
customizablePermissions:OCSharePermissionsMaskUpdate|OCSharePermissionsMaskCreate|OCSharePermissionsMaskDelete|OCSharePermissionsMaskShare
permissions:OCSharePermissionsMaskRead|OCSharePermissionsMaskUpdate|OCSharePermissionsMaskCreate|OCSharePermissionsMaskDelete|(resharingSupported ? OCSharePermissionsMaskShare : 0)
customizablePermissions:OCSharePermissionsMaskUpdate|OCSharePermissionsMaskCreate|OCSharePermissionsMaskDelete|(resharingSupported ? OCSharePermissionsMaskShare : 0)
locations:OCLocationTypeFolder|OCLocationTypeDrive
symbolName:@"gearshape.fill"
localizedName:OCLocalizedString(@"Custom",nil)
localizedDescription:OCLocalizedString(@"Set detailed permissions",nil)],
localizedName:OCLocalizedString(@"Custom", nil)
localizedDescription:OCLocalizedString(@"Set detailed permissions", nil)],
]];

// # LINKS
Expand All @@ -476,8 +477,8 @@ - (nullable NSProgress *)makeDecisionOnShare:(OCShare *)share accept:(BOOL)accep
customizablePermissions:OCSharePermissionsMaskNone
locations:OCLocationTypeFile|OCLocationTypeFolder
symbolName:@"person.fill"
localizedName:OCLocalizedString(@"Invited persons",nil)
localizedDescription:OCLocalizedString(@"Only invited persons have access. Login required.",nil)]
localizedName:OCLocalizedString(@"Invited persons", nil)
localizedDescription:OCLocalizedString(@"Only invited persons have access. Login required.", nil)]
]];
}

Expand All @@ -490,8 +491,8 @@ - (nullable NSProgress *)makeDecisionOnShare:(OCShare *)share accept:(BOOL)accep
customizablePermissions:OCSharePermissionsMaskNone
locations:OCLocationTypeFile|OCLocationTypeFolder
symbolName:@"eye.fill"
localizedName:OCLocalizedString(@"Viewer",nil)
localizedDescription:OCLocalizedString(@"Recipients can view and download contents.",nil)],
localizedName:OCLocalizedString(@"Viewer", nil)
localizedDescription:OCLocalizedString(@"Recipients can view and download contents.", nil)],

// ## Uploader
// - folders
Expand All @@ -501,8 +502,8 @@ - (nullable NSProgress *)makeDecisionOnShare:(OCShare *)share accept:(BOOL)accep
customizablePermissions:OCSharePermissionsMaskNone
locations:OCLocationTypeFolder
symbolName:@"arrow.up.circle.fill"
localizedName:OCLocalizedString(@"Uploader",nil)
localizedDescription:OCLocalizedString(@"Recipients can upload but existing contents are not revealed.",nil)],
localizedName:OCLocalizedString(@"Uploader", nil)
localizedDescription:OCLocalizedString(@"Recipients can upload but existing contents are not revealed.", nil)],

// ## Contributor
// - folders
Expand All @@ -512,8 +513,8 @@ - (nullable NSProgress *)makeDecisionOnShare:(OCShare *)share accept:(BOOL)accep
customizablePermissions:OCSharePermissionsMaskNone
locations:OCLocationTypeFolder
symbolName:@"person.2"
localizedName:OCLocalizedString(@"Contributor",nil)
localizedDescription:OCLocalizedString(@"Recipients can view, download and upload contents.",nil)],
localizedName:OCLocalizedString(@"Contributor", nil)
localizedDescription:OCLocalizedString(@"Recipients can view, download and upload contents.", nil)],

// ## Editor
// - files
Expand All @@ -523,8 +524,8 @@ - (nullable NSProgress *)makeDecisionOnShare:(OCShare *)share accept:(BOOL)accep
customizablePermissions:OCSharePermissionsMaskNone
locations:OCLocationTypeFile
symbolName:@"pencil"
localizedName:OCLocalizedString(@"Editor",nil)
localizedDescription:OCLocalizedString(@"Recipients can view, download and edit contents.",nil)],
localizedName:OCLocalizedString(@"Editor", nil)
localizedDescription:OCLocalizedString(@"Recipients can view, download and edit contents.", nil)],

// - folders
[[OCShareRole alloc] initWithType:OCShareRoleTypeEditor
Expand All @@ -533,8 +534,8 @@ - (nullable NSProgress *)makeDecisionOnShare:(OCShare *)share accept:(BOOL)accep
customizablePermissions:OCSharePermissionsMaskNone
locations:OCLocationTypeFolder
symbolName:@"pencil"
localizedName:OCLocalizedString(@"Editor",nil)
localizedDescription:OCLocalizedString(@"Recipients can view, download, edit, delete and upload contents.",nil)]
localizedName:OCLocalizedString(@"Editor", nil)
localizedDescription:OCLocalizedString(@"Recipients can view, download, edit, delete and upload contents.", nil)]
]];
}

Expand Down
Loading

0 comments on commit f0c6f8f

Please sign in to comment.