RBAC: Refactor GetUserPermissions to use []accesscontrol.Permission (#50683)
* Return slice of permissions instead of slice of pointers for permissions
This commit is contained in:
@@ -514,7 +514,7 @@ func TestLDAP_AccessControl(t *testing.T) {
|
||||
method: http.MethodPost,
|
||||
desc: "ReloadLDAPCfg should return 200 for user with correct permissions",
|
||||
expectedCode: http.StatusOK,
|
||||
permissions: []*accesscontrol.Permission{
|
||||
permissions: []accesscontrol.Permission{
|
||||
{Action: accesscontrol.ActionLDAPConfigReload},
|
||||
},
|
||||
},
|
||||
@@ -523,7 +523,7 @@ func TestLDAP_AccessControl(t *testing.T) {
|
||||
method: http.MethodPost,
|
||||
desc: "ReloadLDAPCfg should return 403 for user without required permissions",
|
||||
expectedCode: http.StatusForbidden,
|
||||
permissions: []*accesscontrol.Permission{
|
||||
permissions: []accesscontrol.Permission{
|
||||
{Action: "wrong"},
|
||||
},
|
||||
},
|
||||
@@ -532,7 +532,7 @@ func TestLDAP_AccessControl(t *testing.T) {
|
||||
method: http.MethodGet,
|
||||
desc: "GetLDAPStatus should return 200 for user without required permissions",
|
||||
expectedCode: http.StatusOK,
|
||||
permissions: []*accesscontrol.Permission{
|
||||
permissions: []accesscontrol.Permission{
|
||||
{Action: accesscontrol.ActionLDAPStatusRead},
|
||||
},
|
||||
},
|
||||
@@ -541,7 +541,7 @@ func TestLDAP_AccessControl(t *testing.T) {
|
||||
method: http.MethodGet,
|
||||
desc: "GetLDAPStatus should return 200 for user without required permissions",
|
||||
expectedCode: http.StatusForbidden,
|
||||
permissions: []*accesscontrol.Permission{
|
||||
permissions: []accesscontrol.Permission{
|
||||
{Action: "wrong"},
|
||||
},
|
||||
},
|
||||
@@ -550,7 +550,7 @@ func TestLDAP_AccessControl(t *testing.T) {
|
||||
method: http.MethodGet,
|
||||
desc: "GetUserFromLDAP should return 200 for user with required permissions",
|
||||
expectedCode: http.StatusOK,
|
||||
permissions: []*accesscontrol.Permission{
|
||||
permissions: []accesscontrol.Permission{
|
||||
{Action: accesscontrol.ActionLDAPUsersRead},
|
||||
},
|
||||
},
|
||||
@@ -559,7 +559,7 @@ func TestLDAP_AccessControl(t *testing.T) {
|
||||
method: http.MethodGet,
|
||||
desc: "GetUserFromLDAP should return 403 for user without required permissions",
|
||||
expectedCode: http.StatusForbidden,
|
||||
permissions: []*accesscontrol.Permission{
|
||||
permissions: []accesscontrol.Permission{
|
||||
{Action: "wrong"},
|
||||
},
|
||||
},
|
||||
@@ -568,7 +568,7 @@ func TestLDAP_AccessControl(t *testing.T) {
|
||||
method: http.MethodPost,
|
||||
desc: "PostSyncUserWithLDAP should return 200 for user without required permissions",
|
||||
expectedCode: http.StatusOK,
|
||||
permissions: []*accesscontrol.Permission{
|
||||
permissions: []accesscontrol.Permission{
|
||||
{Action: accesscontrol.ActionLDAPUsersSync},
|
||||
},
|
||||
},
|
||||
@@ -577,7 +577,7 @@ func TestLDAP_AccessControl(t *testing.T) {
|
||||
method: http.MethodPost,
|
||||
desc: "PostSyncUserWithLDAP should return 200 for user without required permissions",
|
||||
expectedCode: http.StatusForbidden,
|
||||
permissions: []*accesscontrol.Permission{
|
||||
permissions: []accesscontrol.Permission{
|
||||
{Action: "wrong"},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user