Skip to content

Commit

Permalink
feat(api): added /v2/_catalog pagination, fixes project-zot#2715
Browse files Browse the repository at this point in the history
Signed-off-by: Eusebiu Petu <[email protected]>
  • Loading branch information
eusebiu-constantin-petu-dbk committed Nov 23, 2024
1 parent e5af24d commit 590a8ce
Show file tree
Hide file tree
Showing 9 changed files with 15,190 additions and 14,745 deletions.
15 changes: 15 additions & 0 deletions pkg/api/authz.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"zotregistry.dev/zot/pkg/common"
"zotregistry.dev/zot/pkg/log"
reqCtx "zotregistry.dev/zot/pkg/requestcontext"
storageTypes "zotregistry.dev/zot/pkg/storage/types"
)

const (
Expand All @@ -20,6 +21,20 @@ const (
OPENID = "OpenID"
)

func AuthzFilterFunc(userAc *reqCtx.UserAccessControl) storageTypes.FilterRepoFunc {
return func(repo string) (bool, error) {
if userAc == nil {
return true, nil
}

if userAc.Can(constants.ReadPermission, repo) {
return true, nil
}

return false, nil
}
}

// AccessController authorizes users to act on resources.
type AccessController struct {
Config *config.AccessControlConfig
Expand Down
Loading

0 comments on commit 590a8ce

Please sign in to comment.