mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-28 18:41:26 +01:00
Merge pull request #14911 from reasonerjt/fix-14386
Use system configuration resource for permission checking
This commit is contained in:
commit
5be0c6d35a
@ -73,6 +73,4 @@ const (
|
||||
ResourceReplicationPolicy = Resource("replication-policy")
|
||||
ResourceScanAll = Resource("scan-all")
|
||||
ResourceSystemVolumes = Resource("system-volumes")
|
||||
ResourceOIDCEndpoint = Resource("oidc-endpoint")
|
||||
ResourceSystemCVEAllowList = Resource("system-cve-allowlist")
|
||||
)
|
||||
|
@ -61,11 +61,9 @@ var (
|
||||
|
||||
{Resource: rbac.ResourceSystemVolumes, Action: rbac.ActionRead},
|
||||
|
||||
{Resource: rbac.ResourceOIDCEndpoint, Action: rbac.ActionUpdate},
|
||||
{Resource: rbac.ResourceOIDCEndpoint, Action: rbac.ActionRead},
|
||||
{Resource: rbac.ResourceLdapUser, Action: rbac.ActionCreate},
|
||||
{Resource: rbac.ResourceLdapUser, Action: rbac.ActionList},
|
||||
{Resource: rbac.ResourceSystemCVEAllowList, Action: rbac.ActionRead},
|
||||
{Resource: rbac.ResourceSystemCVEAllowList, Action: rbac.ActionUpdate},
|
||||
{Resource: rbac.ResourceConfiguration, Action: rbac.ActionRead},
|
||||
{Resource: rbac.ResourceConfiguration, Action: rbac.ActionUpdate},
|
||||
}
|
||||
)
|
||||
|
@ -20,7 +20,7 @@ func newOIDCAPI() *oidcAPI {
|
||||
}
|
||||
|
||||
func (o oidcAPI) PingOIDC(ctx context.Context, params oidc.PingOIDCParams) middleware.Responder {
|
||||
if err := o.RequireSystemAccess(ctx, rbac.ActionUpdate, rbac.ResourceOIDCEndpoint); err != nil {
|
||||
if err := o.RequireSystemAccess(ctx, rbac.ActionUpdate, rbac.ResourceConfiguration); err != nil {
|
||||
return o.SendError(ctx, err)
|
||||
}
|
||||
err := oidcpkg.TestEndpoint(oidcpkg.Conn{
|
||||
|
@ -38,7 +38,7 @@ func newSystemCVEAllowListAPI() *systemCVEAllowListAPI {
|
||||
}
|
||||
|
||||
func (s systemCVEAllowListAPI) PutSystemCVEAllowlist(ctx context.Context, params system_cve_allowlist.PutSystemCVEAllowlistParams) middleware.Responder {
|
||||
if err := s.RequireSystemAccess(ctx, rbac.ActionUpdate, rbac.ResourceSystemCVEAllowList); err != nil {
|
||||
if err := s.RequireSystemAccess(ctx, rbac.ActionUpdate, rbac.ResourceConfiguration); err != nil {
|
||||
return s.SendError(ctx, err)
|
||||
}
|
||||
l := models.CVEAllowlist{}
|
||||
|
Loading…
Reference in New Issue
Block a user