Skip to content
Merged
Changes from all commits
Commits
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
33 changes: 33 additions & 0 deletions storage/eoswrapper/eoswrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,39 @@ func (w *wrapper) RestoreRevision(ctx context.Context, ref *provider.Reference,
return w.FSWithListRegexSupport.RestoreRevision(ctx, ref, revisionKey)
}

func (w *wrapper) AddGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) error {
// AddGrant is only allowed for admins in a project space
if w.isProjectInstance() {
if err := w.userIsProjectMember(ctx, ref, requireAdmin); err != nil {
return errtypes.PermissionDenied("eosfs: deny grant can only be set by project admins")
}
}

return w.FSWithListRegexSupport.AddGrant(ctx, ref, g)
}

func (w *wrapper) UpdateGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) error {
// UpdateGrant is only allowed for admins in a project space
if w.isProjectInstance() {
if err := w.userIsProjectMember(ctx, ref, requireAdmin); err != nil {
return errtypes.PermissionDenied("eosfs: deny grant can only be set by project admins")
}
}

return w.FSWithListRegexSupport.UpdateGrant(ctx, ref, g)
}

func (w *wrapper) RemoveGrant(ctx context.Context, ref *provider.Reference, g *provider.Grant) error {
// RemoveGrant is only allowed for admins in a project space
if w.isProjectInstance() {
if err := w.userIsProjectMember(ctx, ref, requireAdmin); err != nil {
return errtypes.PermissionDenied("eosfs: deny grant can only be set by project admins")
}
}

return w.FSWithListRegexSupport.RemoveGrant(ctx, ref, g)
}

func (w *wrapper) DenyGrant(ctx context.Context, ref *provider.Reference, g *provider.Grantee) error {
// This is only allowed for project space admins
if w.isProjectInstance() {
Expand Down