mirror of
https://github.com/passbolt/go-passbolt.git
synced 2025-05-10 01:48:22 +00:00
Use Folder Get Function for Permissions
This commit is contained in:
parent
7e96b96c36
commit
9bceb71ed2
1 changed files with 4 additions and 2 deletions
|
@ -126,12 +126,14 @@ func ShareFolderWithUsersAndGroups(ctx context.Context, c *api.Client, folderID
|
||||||
// ShareFolder Shares a Folder as Specified in the Passed ShareOperation Struct Slice.
|
// ShareFolder Shares a Folder as Specified in the Passed ShareOperation Struct Slice.
|
||||||
// Note Resources Permissions in the Folder are not Adjusted
|
// Note Resources Permissions in the Folder are not Adjusted
|
||||||
func ShareFolder(ctx context.Context, c *api.Client, folderID string, changes []ShareOperation) error {
|
func ShareFolder(ctx context.Context, c *api.Client, folderID string, changes []ShareOperation) error {
|
||||||
oldPermissions, err := c.GetFolderPermissions(ctx, folderID)
|
oldFolder, err := c.GetFolder(ctx, folderID, &api.GetFolderOptions{
|
||||||
|
ContainPermissions: true,
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Getting Folder Permissions: %w", err)
|
return fmt.Errorf("Getting Folder Permissions: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
permissionChanges, err := GeneratePermissionChanges(oldPermissions, changes)
|
permissionChanges, err := GeneratePermissionChanges(oldFolder.Permissions, changes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Generating Folder Permission Changes: %w", err)
|
return fmt.Errorf("Generating Folder Permission Changes: %w", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue