Move SignedInUser to user service and RoleType and Roles to org (#53445)
* Move SignedInUser to user service and RoleType and Roles to org * Use go naming convention for roles * Fix some imports and leftovers * Fix ldap debug test * Fix lint * Fix lint 2 * Fix lint 3 * Fix type and not needed conversion * Clean up messages in api tests * Clean up api tests 2
This commit is contained in:
@@ -26,7 +26,7 @@ func TestSQLStore_GetOrgUsers(t *testing.T) {
|
||||
desc: "should return all users",
|
||||
query: &models.GetOrgUsersQuery{
|
||||
OrgId: 1,
|
||||
User: &models.SignedInUser{
|
||||
User: &user.SignedInUser{
|
||||
OrgId: 1,
|
||||
Permissions: map[int64]map[string][]string{1: {ac.ActionOrgUsersRead: {ac.ScopeUsersAll}}},
|
||||
},
|
||||
@@ -37,7 +37,7 @@ func TestSQLStore_GetOrgUsers(t *testing.T) {
|
||||
desc: "should return no users",
|
||||
query: &models.GetOrgUsersQuery{
|
||||
OrgId: 1,
|
||||
User: &models.SignedInUser{
|
||||
User: &user.SignedInUser{
|
||||
OrgId: 1,
|
||||
Permissions: map[int64]map[string][]string{1: {ac.ActionOrgUsersRead: {""}}},
|
||||
},
|
||||
@@ -48,7 +48,7 @@ func TestSQLStore_GetOrgUsers(t *testing.T) {
|
||||
desc: "should return some users",
|
||||
query: &models.GetOrgUsersQuery{
|
||||
OrgId: 1,
|
||||
User: &models.SignedInUser{
|
||||
User: &user.SignedInUser{
|
||||
OrgId: 1,
|
||||
Permissions: map[int64]map[string][]string{1: {ac.ActionOrgUsersRead: {
|
||||
"users:id:1",
|
||||
@@ -95,7 +95,7 @@ func TestSQLStore_SearchOrgUsers(t *testing.T) {
|
||||
desc: "should return all users",
|
||||
query: &models.SearchOrgUsersQuery{
|
||||
OrgID: 1,
|
||||
User: &models.SignedInUser{
|
||||
User: &user.SignedInUser{
|
||||
OrgId: 1,
|
||||
Permissions: map[int64]map[string][]string{1: {ac.ActionOrgUsersRead: {ac.ScopeUsersAll}}},
|
||||
},
|
||||
@@ -106,7 +106,7 @@ func TestSQLStore_SearchOrgUsers(t *testing.T) {
|
||||
desc: "should return no users",
|
||||
query: &models.SearchOrgUsersQuery{
|
||||
OrgID: 1,
|
||||
User: &models.SignedInUser{
|
||||
User: &user.SignedInUser{
|
||||
OrgId: 1,
|
||||
Permissions: map[int64]map[string][]string{1: {ac.ActionOrgUsersRead: {""}}},
|
||||
},
|
||||
@@ -117,7 +117,7 @@ func TestSQLStore_SearchOrgUsers(t *testing.T) {
|
||||
desc: "should return some users",
|
||||
query: &models.SearchOrgUsersQuery{
|
||||
OrgID: 1,
|
||||
User: &models.SignedInUser{
|
||||
User: &user.SignedInUser{
|
||||
OrgId: 1,
|
||||
Permissions: map[int64]map[string][]string{1: {ac.ActionOrgUsersRead: {
|
||||
"users:id:1",
|
||||
@@ -271,7 +271,7 @@ func seedOrgUsers(t *testing.T, store *SQLStore, numUsers int) {
|
||||
}
|
||||
}
|
||||
|
||||
func hasWildcardScope(user *models.SignedInUser, action string) bool {
|
||||
func hasWildcardScope(user *user.SignedInUser, action string) bool {
|
||||
for _, scope := range user.Permissions[user.OrgId][action] {
|
||||
if strings.HasSuffix(scope, ":*") {
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user