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

[full-ci] Allow no permissions on Links #2687

Merged
merged 16 commits into from
Apr 4, 2022
Prev Previous commit
Next Next commit
don't allow weird permissions on files
Signed-off-by: jkoberg <[email protected]>
  • Loading branch information
kobergj committed Mar 31, 2022
commit 68ceca5ef27d999efbe23a58c6b83460599ef3b8
Original file line number Diff line number Diff line change
Expand Up @@ -426,19 +426,17 @@ func (h *Handler) extractPermissions(w http.ResponseWriter, r *http.Request, ri
}

permissions := role.OCSPermissions()
if ri != nil && ri.Type == provider.ResourceType_RESOURCE_TYPE_FILE {
if ri != nil && ri.Type == provider.ResourceType_RESOURCE_TYPE_FILE && permissions != conversions.PermissionInvalid {
// Single file shares should never have delete or create permissions
permissions &^= conversions.PermissionCreate
permissions &^= conversions.PermissionDelete
/*
if permissions == conversions.PermissionInvalid {
return nil, nil, &ocsError{
Code: response.MetaBadRequest.StatusCode,
Message: "Cannot set the requested share permissions",
Error: errors.New("cannot set the requested share permissions"),
}
if permissions == conversions.PermissionInvalid {
return nil, nil, &ocsError{
Code: response.MetaBadRequest.StatusCode,
Message: "Cannot set the requested share permissions",
Error: errors.New("cannot set the requested share permissions"),
}
*/
}
}

existingPermissions := conversions.RoleFromResourcePermissions(ri.PermissionSet).OCSPermissions()
Expand Down