mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-19 07:07:42 +01:00
Merge pull request #9754 from steven-zou/fix/role_binding
revoke scan permission from the developer role
This commit is contained in:
commit
b87373d6a9
@ -269,7 +269,6 @@ var (
|
|||||||
{Resource: rbac.ResourceRobot, Action: rbac.ActionRead},
|
{Resource: rbac.ResourceRobot, Action: rbac.ActionRead},
|
||||||
{Resource: rbac.ResourceRobot, Action: rbac.ActionList},
|
{Resource: rbac.ResourceRobot, Action: rbac.ActionList},
|
||||||
|
|
||||||
{Resource: rbac.ResourceScan, Action: rbac.ActionCreate},
|
|
||||||
{Resource: rbac.ResourceScan, Action: rbac.ActionRead},
|
{Resource: rbac.ResourceScan, Action: rbac.ActionRead},
|
||||||
|
|
||||||
{Resource: rbac.ResourceScanner, Action: rbac.ActionRead},
|
{Resource: rbac.ResourceScanner, Action: rbac.ActionRead},
|
||||||
|
@ -18,8 +18,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/goharbor/harbor/src/common/dao"
|
|
||||||
"github.com/goharbor/harbor/src/common/dao/project"
|
|
||||||
"github.com/goharbor/harbor/src/common/models"
|
"github.com/goharbor/harbor/src/common/models"
|
||||||
"github.com/goharbor/harbor/src/testing/apitests/apilib"
|
"github.com/goharbor/harbor/src/testing/apitests/apilib"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
@ -230,24 +228,6 @@ func TestPopulateAuthor(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPutOfRepository(t *testing.T) {
|
func TestPutOfRepository(t *testing.T) {
|
||||||
u, err := dao.GetUser(models.User{
|
|
||||||
Username: projAdmin.Name,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
t.Errorf("Error occurred when Register user: %v", err)
|
|
||||||
}
|
|
||||||
pmid, err := project.AddProjectMember(
|
|
||||||
models.Member{
|
|
||||||
ProjectID: 1,
|
|
||||||
Role: 1,
|
|
||||||
EntityID: int(u.UserID),
|
|
||||||
EntityType: "u"},
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
t.Errorf("Error occurred when add project member: %v", err)
|
|
||||||
}
|
|
||||||
defer project.DeleteProjectMemberByID(pmid)
|
|
||||||
|
|
||||||
base := "/api/repositories/"
|
base := "/api/repositories/"
|
||||||
desc := struct {
|
desc := struct {
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
@ -329,7 +309,7 @@ func TestPutOfRepository(t *testing.T) {
|
|||||||
|
|
||||||
// verify that the description is changed
|
// verify that the description is changed
|
||||||
repositories := []*repoResp{}
|
repositories := []*repoResp{}
|
||||||
err = handleAndParse(&testingRequest{
|
err := handleAndParse(&testingRequest{
|
||||||
method: http.MethodGet,
|
method: http.MethodGet,
|
||||||
url: base,
|
url: base,
|
||||||
queryStruct: struct {
|
queryStruct: struct {
|
||||||
|
@ -19,9 +19,8 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/goharbor/harbor/src/pkg/scan/all"
|
|
||||||
|
|
||||||
"github.com/goharbor/harbor/src/jobservice/job"
|
"github.com/goharbor/harbor/src/jobservice/job"
|
||||||
|
"github.com/goharbor/harbor/src/pkg/scan/all"
|
||||||
"github.com/goharbor/harbor/src/pkg/scan/api/scan"
|
"github.com/goharbor/harbor/src/pkg/scan/api/scan"
|
||||||
dscan "github.com/goharbor/harbor/src/pkg/scan/dao/scan"
|
dscan "github.com/goharbor/harbor/src/pkg/scan/dao/scan"
|
||||||
"github.com/goharbor/harbor/src/pkg/scan/report"
|
"github.com/goharbor/harbor/src/pkg/scan/report"
|
||||||
@ -119,7 +118,7 @@ func (suite *ScanAPITestSuite) TestScanAPIScan() {
|
|||||||
request: &testingRequest{
|
request: &testingRequest{
|
||||||
url: scanBaseURL,
|
url: scanBaseURL,
|
||||||
method: http.MethodPost,
|
method: http.MethodPost,
|
||||||
credential: projDeveloper,
|
credential: projAdmin,
|
||||||
},
|
},
|
||||||
code: http.StatusAccepted,
|
code: http.StatusAccepted,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user