Skip to content

Commit

Permalink
fix: return better status code
Browse files Browse the repository at this point in the history
  • Loading branch information
micbar committed Dec 6, 2023
1 parent 3d1c50d commit f73ddd1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions internal/grpc/services/usershareprovider/usershareprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ func (s *service) CreateShare(ctx context.Context, req *collaboration.CreateShar
req.GetGrant().GetPermissions().GetPermissions(),
); !shareCreationAllowed {
return &collaboration.CreateShareResponse{
Status: status.NewInvalid(ctx, "insufficient permissions to create that kind of share"),
Status: status.NewPermissionDenied(ctx, nil, "insufficient permissions to create that kind of share"),
}, nil
}

if !s.isPathAllowed(req.GetResourceInfo().GetPath()) {
return &collaboration.CreateShareResponse{
Status: status.NewInvalid(ctx, "share creation is not allowed for the specified path"),
Status: status.NewFailedPrecondition(ctx, nil, "share creation is not allowed for the specified path"),
}, nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ var _ = Describe("user share provider service", func() {
"insufficient permissions",
conversions.RoleFromName("spaceeditor", true).CS3ResourcePermissions(),
conversions.RoleFromName("manager", true).CS3ResourcePermissions(),
rpcpb.Code_CODE_INVALID_ARGUMENT,
rpcpb.Code_CODE_PERMISSION_DENIED,
0,
),
Entry(
Expand Down

0 comments on commit f73ddd1

Please sign in to comment.