@ -184,7 +184,7 @@ func (sc *scenarioContext) defaultPermissionScenario(pt permissionType, flag per
_ , callerFile , callerLine , _ := runtime . Caller ( 1 )
_ , callerFile , callerLine , _ := runtime . Caller ( 1 )
sc . callerFile = callerFile
sc . callerFile = callerFile
sc . callerLine = callerLine
sc . callerLine = callerLine
existingPermissions := [ ] * models . DashboardAcl InfoDTO {
existingPermissions := [ ] * models . DashboardACL InfoDTO {
toDto ( newEditorRolePermission ( defaultDashboardID , models . PERMISSION_EDIT ) ) ,
toDto ( newEditorRolePermission ( defaultDashboardID , models . PERMISSION_EDIT ) ) ,
toDto ( newViewerRolePermission ( defaultDashboardID , models . PERMISSION_VIEW ) ) ,
toDto ( newViewerRolePermission ( defaultDashboardID , models . PERMISSION_VIEW ) ) ,
}
}
@ -203,17 +203,17 @@ func (sc *scenarioContext) dashboardPermissionScenario(pt permissionType, permis
_ , callerFile , callerLine , _ := runtime . Caller ( 1 )
_ , callerFile , callerLine , _ := runtime . Caller ( 1 )
sc . callerFile = callerFile
sc . callerFile = callerFile
sc . callerLine = callerLine
sc . callerLine = callerLine
var existingPermissions [ ] * models . DashboardAcl InfoDTO
var existingPermissions [ ] * models . DashboardACL InfoDTO
switch pt {
switch pt {
case USER :
case USER :
existingPermissions = [ ] * models . DashboardAcl InfoDTO { { OrgId : orgID , DashboardId : dashboardID , UserId : userID , Permission : permission } }
existingPermissions = [ ] * models . DashboardACL InfoDTO { { OrgId : orgID , DashboardId : dashboardID , UserId : userID , Permission : permission } }
case TEAM :
case TEAM :
existingPermissions = [ ] * models . DashboardAcl InfoDTO { { OrgId : orgID , DashboardId : dashboardID , TeamId : teamID , Permission : permission } }
existingPermissions = [ ] * models . DashboardACL InfoDTO { { OrgId : orgID , DashboardId : dashboardID , TeamId : teamID , Permission : permission } }
case EDITOR :
case EDITOR :
existingPermissions = [ ] * models . DashboardAcl InfoDTO { { OrgId : orgID , DashboardId : dashboardID , Role : & editorRole , Permission : permission } }
existingPermissions = [ ] * models . DashboardACL InfoDTO { { OrgId : orgID , DashboardId : dashboardID , Role : & editorRole , Permission : permission } }
case VIEWER :
case VIEWER :
existingPermissions = [ ] * models . DashboardAcl InfoDTO { { OrgId : orgID , DashboardId : dashboardID , Role : & viewerRole , Permission : permission } }
existingPermissions = [ ] * models . DashboardACL InfoDTO { { OrgId : orgID , DashboardId : dashboardID , Role : & viewerRole , Permission : permission } }
}
}
permissionScenario ( fmt . Sprintf ( "and %s has permission to %s dashboard" , pt . String ( ) , permission . String ( ) ) ,
permissionScenario ( fmt . Sprintf ( "and %s has permission to %s dashboard" , pt . String ( ) , permission . String ( ) ) ,
@ -230,20 +230,20 @@ func (sc *scenarioContext) parentFolderPermissionScenario(pt permissionType, per
_ , callerFile , callerLine , _ := runtime . Caller ( 1 )
_ , callerFile , callerLine , _ := runtime . Caller ( 1 )
sc . callerFile = callerFile
sc . callerFile = callerFile
sc . callerLine = callerLine
sc . callerLine = callerLine
var folderPermissionList [ ] * models . DashboardAcl InfoDTO
var folderPermissionList [ ] * models . DashboardACL InfoDTO
switch pt {
switch pt {
case USER :
case USER :
folderPermissionList = [ ] * models . DashboardAcl InfoDTO { { OrgId : orgID , DashboardId : parentFolderID ,
folderPermissionList = [ ] * models . DashboardACL InfoDTO { { OrgId : orgID , DashboardId : parentFolderID ,
UserId : userID , Permission : permission , Inherited : true } }
UserId : userID , Permission : permission , Inherited : true } }
case TEAM :
case TEAM :
folderPermissionList = [ ] * models . DashboardAcl InfoDTO { { OrgId : orgID , DashboardId : parentFolderID , TeamId : teamID ,
folderPermissionList = [ ] * models . DashboardACL InfoDTO { { OrgId : orgID , DashboardId : parentFolderID , TeamId : teamID ,
Permission : permission , Inherited : true } }
Permission : permission , Inherited : true } }
case EDITOR :
case EDITOR :
folderPermissionList = [ ] * models . DashboardAcl InfoDTO { { OrgId : orgID , DashboardId : parentFolderID ,
folderPermissionList = [ ] * models . DashboardACL InfoDTO { { OrgId : orgID , DashboardId : parentFolderID ,
Role : & editorRole , Permission : permission , Inherited : true } }
Role : & editorRole , Permission : permission , Inherited : true } }
case VIEWER :
case VIEWER :
folderPermissionList = [ ] * models . DashboardAcl InfoDTO { { OrgId : orgID , DashboardId : parentFolderID ,
folderPermissionList = [ ] * models . DashboardACL InfoDTO { { OrgId : orgID , DashboardId : parentFolderID ,
Role : & viewerRole , Permission : permission , Inherited : true } }
Role : & viewerRole , Permission : permission , Inherited : true } }
}
}
@ -308,7 +308,7 @@ func (sc *scenarioContext) verifyDuplicatePermissionsShouldNotBeAllowed() {
tc := "When updating dashboard permissions with duplicate permission for user should not be allowed"
tc := "When updating dashboard permissions with duplicate permission for user should not be allowed"
sc . t . Run ( tc , func ( t * testing . T ) {
sc . t . Run ( tc , func ( t * testing . T ) {
p := [ ] * models . DashboardAcl {
p := [ ] * models . DashboardACL {
newDefaultUserPermission ( dashboardID , models . PERMISSION_VIEW ) ,
newDefaultUserPermission ( dashboardID , models . PERMISSION_VIEW ) ,
newDefaultUserPermission ( dashboardID , models . PERMISSION_ADMIN ) ,
newDefaultUserPermission ( dashboardID , models . PERMISSION_ADMIN ) ,
}
}
@ -323,7 +323,7 @@ func (sc *scenarioContext) verifyDuplicatePermissionsShouldNotBeAllowed() {
tc = "When updating dashboard permissions with duplicate permission for team should not be allowed"
tc = "When updating dashboard permissions with duplicate permission for team should not be allowed"
sc . t . Run ( tc , func ( t * testing . T ) {
sc . t . Run ( tc , func ( t * testing . T ) {
p := [ ] * models . DashboardAcl {
p := [ ] * models . DashboardACL {
newDefaultTeamPermission ( dashboardID , models . PERMISSION_VIEW ) ,
newDefaultTeamPermission ( dashboardID , models . PERMISSION_VIEW ) ,
newDefaultTeamPermission ( dashboardID , models . PERMISSION_ADMIN ) ,
newDefaultTeamPermission ( dashboardID , models . PERMISSION_ADMIN ) ,
}
}
@ -337,7 +337,7 @@ func (sc *scenarioContext) verifyDuplicatePermissionsShouldNotBeAllowed() {
tc = "When updating dashboard permissions with duplicate permission for editor role should not be allowed"
tc = "When updating dashboard permissions with duplicate permission for editor role should not be allowed"
sc . t . Run ( tc , func ( t * testing . T ) {
sc . t . Run ( tc , func ( t * testing . T ) {
p := [ ] * models . DashboardAcl {
p := [ ] * models . DashboardACL {
newEditorRolePermission ( dashboardID , models . PERMISSION_VIEW ) ,
newEditorRolePermission ( dashboardID , models . PERMISSION_VIEW ) ,
newEditorRolePermission ( dashboardID , models . PERMISSION_ADMIN ) ,
newEditorRolePermission ( dashboardID , models . PERMISSION_ADMIN ) ,
}
}
@ -352,7 +352,7 @@ func (sc *scenarioContext) verifyDuplicatePermissionsShouldNotBeAllowed() {
tc = "When updating dashboard permissions with duplicate permission for viewer role should not be allowed"
tc = "When updating dashboard permissions with duplicate permission for viewer role should not be allowed"
sc . t . Run ( tc , func ( t * testing . T ) {
sc . t . Run ( tc , func ( t * testing . T ) {
p := [ ] * models . DashboardAcl {
p := [ ] * models . DashboardACL {
newViewerRolePermission ( dashboardID , models . PERMISSION_VIEW ) ,
newViewerRolePermission ( dashboardID , models . PERMISSION_VIEW ) ,
newViewerRolePermission ( dashboardID , models . PERMISSION_ADMIN ) ,
newViewerRolePermission ( dashboardID , models . PERMISSION_ADMIN ) ,
}
}
@ -366,7 +366,7 @@ func (sc *scenarioContext) verifyDuplicatePermissionsShouldNotBeAllowed() {
tc = "When updating dashboard permissions with duplicate permission for admin role should not be allowed"
tc = "When updating dashboard permissions with duplicate permission for admin role should not be allowed"
sc . t . Run ( tc , func ( t * testing . T ) {
sc . t . Run ( tc , func ( t * testing . T ) {
p := [ ] * models . DashboardAcl {
p := [ ] * models . DashboardACL {
newAdminRolePermission ( dashboardID , models . PERMISSION_ADMIN ) ,
newAdminRolePermission ( dashboardID , models . PERMISSION_ADMIN ) ,
}
}
sc . updatePermissions = p
sc . updatePermissions = p
@ -386,24 +386,24 @@ func (sc *scenarioContext) verifyUpdateDashboardPermissionsShouldBeAllowed(pt pe
for _ , p := range [ ] models . PermissionType { models . PERMISSION_ADMIN , models . PERMISSION_EDIT , models . PERMISSION_VIEW } {
for _ , p := range [ ] models . PermissionType { models . PERMISSION_ADMIN , models . PERMISSION_EDIT , models . PERMISSION_VIEW } {
tc := fmt . Sprintf ( "When updating dashboard permissions with %s permissions should be allowed" , p . String ( ) )
tc := fmt . Sprintf ( "When updating dashboard permissions with %s permissions should be allowed" , p . String ( ) )
sc . t . Run ( tc , func ( t * testing . T ) {
sc . t . Run ( tc , func ( t * testing . T ) {
permissionList := [ ] * models . DashboardAcl { }
permissionList := [ ] * models . DashboardACL { }
switch pt {
switch pt {
case USER :
case USER :
permissionList = [ ] * models . DashboardAcl {
permissionList = [ ] * models . DashboardACL {
newEditorRolePermission ( dashboardID , p ) ,
newEditorRolePermission ( dashboardID , p ) ,
newViewerRolePermission ( dashboardID , p ) ,
newViewerRolePermission ( dashboardID , p ) ,
newCustomUserPermission ( dashboardID , otherUserID , p ) ,
newCustomUserPermission ( dashboardID , otherUserID , p ) ,
newDefaultTeamPermission ( dashboardID , p ) ,
newDefaultTeamPermission ( dashboardID , p ) ,
}
}
case TEAM :
case TEAM :
permissionList = [ ] * models . DashboardAcl {
permissionList = [ ] * models . DashboardACL {
newEditorRolePermission ( dashboardID , p ) ,
newEditorRolePermission ( dashboardID , p ) ,
newViewerRolePermission ( dashboardID , p ) ,
newViewerRolePermission ( dashboardID , p ) ,
newDefaultUserPermission ( dashboardID , p ) ,
newDefaultUserPermission ( dashboardID , p ) ,
newCustomTeamPermission ( dashboardID , otherTeamID , p ) ,
newCustomTeamPermission ( dashboardID , otherTeamID , p ) ,
}
}
case EDITOR , VIEWER :
case EDITOR , VIEWER :
permissionList = [ ] * models . DashboardAcl {
permissionList = [ ] * models . DashboardACL {
newEditorRolePermission ( dashboardID , p ) ,
newEditorRolePermission ( dashboardID , p ) ,
newViewerRolePermission ( dashboardID , p ) ,
newViewerRolePermission ( dashboardID , p ) ,
newDefaultUserPermission ( dashboardID , p ) ,
newDefaultUserPermission ( dashboardID , p ) ,
@ -432,18 +432,18 @@ func (sc *scenarioContext) verifyUpdateDashboardPermissionsShouldNotBeAllowed(pt
for _ , p := range [ ] models . PermissionType { models . PERMISSION_ADMIN , models . PERMISSION_EDIT , models . PERMISSION_VIEW } {
for _ , p := range [ ] models . PermissionType { models . PERMISSION_ADMIN , models . PERMISSION_EDIT , models . PERMISSION_VIEW } {
tc := fmt . Sprintf ( "When updating dashboard permissions with %s permissions should NOT be allowed" , p . String ( ) )
tc := fmt . Sprintf ( "When updating dashboard permissions with %s permissions should NOT be allowed" , p . String ( ) )
sc . t . Run ( tc , func ( t * testing . T ) {
sc . t . Run ( tc , func ( t * testing . T ) {
permissionList := [ ] * models . DashboardAcl {
permissionList := [ ] * models . DashboardACL {
newEditorRolePermission ( dashboardID , p ) ,
newEditorRolePermission ( dashboardID , p ) ,
newViewerRolePermission ( dashboardID , p ) ,
newViewerRolePermission ( dashboardID , p ) ,
}
}
switch pt {
switch pt {
case USER :
case USER :
permissionList = append ( permissionList , [ ] * models . DashboardAcl {
permissionList = append ( permissionList , [ ] * models . DashboardACL {
newCustomUserPermission ( dashboardID , otherUserID , p ) ,
newCustomUserPermission ( dashboardID , otherUserID , p ) ,
newDefaultTeamPermission ( dashboardID , p ) ,
newDefaultTeamPermission ( dashboardID , p ) ,
} ... )
} ... )
case TEAM :
case TEAM :
permissionList = append ( permissionList , [ ] * models . DashboardAcl {
permissionList = append ( permissionList , [ ] * models . DashboardACL {
newDefaultUserPermission ( dashboardID , p ) ,
newDefaultUserPermission ( dashboardID , p ) ,
newCustomTeamPermission ( dashboardID , otherTeamID , p ) ,
newCustomTeamPermission ( dashboardID , otherTeamID , p ) ,
} ... )
} ... )
@ -472,24 +472,24 @@ func (sc *scenarioContext) verifyUpdateChildDashboardPermissionsShouldBeAllowed(
for _ , p := range [ ] models . PermissionType { models . PERMISSION_ADMIN , models . PERMISSION_EDIT , models . PERMISSION_VIEW } {
for _ , p := range [ ] models . PermissionType { models . PERMISSION_ADMIN , models . PERMISSION_EDIT , models . PERMISSION_VIEW } {
tc := fmt . Sprintf ( "When updating child dashboard permissions with %s permissions should be allowed" , p . String ( ) )
tc := fmt . Sprintf ( "When updating child dashboard permissions with %s permissions should be allowed" , p . String ( ) )
sc . t . Run ( tc , func ( t * testing . T ) {
sc . t . Run ( tc , func ( t * testing . T ) {
permissionList := [ ] * models . DashboardAcl { }
permissionList := [ ] * models . DashboardACL { }
switch pt {
switch pt {
case USER :
case USER :
permissionList = [ ] * models . DashboardAcl {
permissionList = [ ] * models . DashboardACL {
newEditorRolePermission ( childDashboardID , p ) ,
newEditorRolePermission ( childDashboardID , p ) ,
newViewerRolePermission ( childDashboardID , p ) ,
newViewerRolePermission ( childDashboardID , p ) ,
newCustomUserPermission ( childDashboardID , otherUserID , p ) ,
newCustomUserPermission ( childDashboardID , otherUserID , p ) ,
newDefaultTeamPermission ( childDashboardID , p ) ,
newDefaultTeamPermission ( childDashboardID , p ) ,
}
}
case TEAM :
case TEAM :
permissionList = [ ] * models . DashboardAcl {
permissionList = [ ] * models . DashboardACL {
newEditorRolePermission ( childDashboardID , p ) ,
newEditorRolePermission ( childDashboardID , p ) ,
newViewerRolePermission ( childDashboardID , p ) ,
newViewerRolePermission ( childDashboardID , p ) ,
newDefaultUserPermission ( childDashboardID , p ) ,
newDefaultUserPermission ( childDashboardID , p ) ,
newCustomTeamPermission ( childDashboardID , otherTeamID , p ) ,
newCustomTeamPermission ( childDashboardID , otherTeamID , p ) ,
}
}
case EDITOR :
case EDITOR :
permissionList = [ ] * models . DashboardAcl {
permissionList = [ ] * models . DashboardACL {
newViewerRolePermission ( childDashboardID , p ) ,
newViewerRolePermission ( childDashboardID , p ) ,
newDefaultUserPermission ( childDashboardID , p ) ,
newDefaultUserPermission ( childDashboardID , p ) ,
newDefaultTeamPermission ( childDashboardID , p ) ,
newDefaultTeamPermission ( childDashboardID , p ) ,
@ -500,7 +500,7 @@ func (sc *scenarioContext) verifyUpdateChildDashboardPermissionsShouldBeAllowed(
permissionList = append ( permissionList , newEditorRolePermission ( childDashboardID , p ) )
permissionList = append ( permissionList , newEditorRolePermission ( childDashboardID , p ) )
}
}
case VIEWER :
case VIEWER :
permissionList = [ ] * models . DashboardAcl {
permissionList = [ ] * models . DashboardACL {
newEditorRolePermission ( childDashboardID , p ) ,
newEditorRolePermission ( childDashboardID , p ) ,
newDefaultUserPermission ( childDashboardID , p ) ,
newDefaultUserPermission ( childDashboardID , p ) ,
newDefaultTeamPermission ( childDashboardID , p ) ,
newDefaultTeamPermission ( childDashboardID , p ) ,
@ -533,24 +533,24 @@ func (sc *scenarioContext) verifyUpdateChildDashboardPermissionsShouldNotBeAllow
for _ , p := range [ ] models . PermissionType { models . PERMISSION_ADMIN , models . PERMISSION_EDIT , models . PERMISSION_VIEW } {
for _ , p := range [ ] models . PermissionType { models . PERMISSION_ADMIN , models . PERMISSION_EDIT , models . PERMISSION_VIEW } {
tc := fmt . Sprintf ( "When updating child dashboard permissions with %s permissions should NOT be allowed" , p . String ( ) )
tc := fmt . Sprintf ( "When updating child dashboard permissions with %s permissions should NOT be allowed" , p . String ( ) )
sc . t . Run ( tc , func ( t * testing . T ) {
sc . t . Run ( tc , func ( t * testing . T ) {
permissionList := [ ] * models . DashboardAcl { }
permissionList := [ ] * models . DashboardACL { }
switch pt {
switch pt {
case USER :
case USER :
permissionList = [ ] * models . DashboardAcl {
permissionList = [ ] * models . DashboardACL {
newEditorRolePermission ( childDashboardID , p ) ,
newEditorRolePermission ( childDashboardID , p ) ,
newViewerRolePermission ( childDashboardID , p ) ,
newViewerRolePermission ( childDashboardID , p ) ,
newCustomUserPermission ( childDashboardID , otherUserID , p ) ,
newCustomUserPermission ( childDashboardID , otherUserID , p ) ,
newDefaultTeamPermission ( childDashboardID , p ) ,
newDefaultTeamPermission ( childDashboardID , p ) ,
}
}
case TEAM :
case TEAM :
permissionList = [ ] * models . DashboardAcl {
permissionList = [ ] * models . DashboardACL {
newEditorRolePermission ( childDashboardID , p ) ,
newEditorRolePermission ( childDashboardID , p ) ,
newViewerRolePermission ( childDashboardID , p ) ,
newViewerRolePermission ( childDashboardID , p ) ,
newDefaultUserPermission ( childDashboardID , p ) ,
newDefaultUserPermission ( childDashboardID , p ) ,
newCustomTeamPermission ( childDashboardID , otherTeamID , p ) ,
newCustomTeamPermission ( childDashboardID , otherTeamID , p ) ,
}
}
case EDITOR :
case EDITOR :
permissionList = [ ] * models . DashboardAcl {
permissionList = [ ] * models . DashboardACL {
newViewerRolePermission ( childDashboardID , p ) ,
newViewerRolePermission ( childDashboardID , p ) ,
newDefaultUserPermission ( childDashboardID , p ) ,
newDefaultUserPermission ( childDashboardID , p ) ,
newDefaultTeamPermission ( childDashboardID , p ) ,
newDefaultTeamPermission ( childDashboardID , p ) ,
@ -561,7 +561,7 @@ func (sc *scenarioContext) verifyUpdateChildDashboardPermissionsShouldNotBeAllow
permissionList = append ( permissionList , newEditorRolePermission ( childDashboardID , p ) )
permissionList = append ( permissionList , newEditorRolePermission ( childDashboardID , p ) )
}
}
case VIEWER :
case VIEWER :
permissionList = [ ] * models . DashboardAcl {
permissionList = [ ] * models . DashboardACL {
newEditorRolePermission ( childDashboardID , p ) ,
newEditorRolePermission ( childDashboardID , p ) ,
newDefaultUserPermission ( childDashboardID , p ) ,
newDefaultUserPermission ( childDashboardID , p ) ,
newDefaultTeamPermission ( childDashboardID , p ) ,
newDefaultTeamPermission ( childDashboardID , p ) ,
@ -599,22 +599,22 @@ func (sc *scenarioContext) verifyUpdateChildDashboardPermissionsWithOverrideShou
tc := fmt . Sprintf ( "When updating child dashboard permissions overriding parent %s permission with %s permission should NOT be allowed" , pt . String ( ) , p . String ( ) )
tc := fmt . Sprintf ( "When updating child dashboard permissions overriding parent %s permission with %s permission should NOT be allowed" , pt . String ( ) , p . String ( ) )
sc . t . Run ( tc , func ( t * testing . T ) {
sc . t . Run ( tc , func ( t * testing . T ) {
permissionList := [ ] * models . DashboardAcl { }
permissionList := [ ] * models . DashboardACL { }
switch pt {
switch pt {
case USER :
case USER :
permissionList = [ ] * models . DashboardAcl {
permissionList = [ ] * models . DashboardACL {
newDefaultUserPermission ( childDashboardID , p ) ,
newDefaultUserPermission ( childDashboardID , p ) ,
}
}
case TEAM :
case TEAM :
permissionList = [ ] * models . DashboardAcl {
permissionList = [ ] * models . DashboardACL {
newDefaultTeamPermission ( childDashboardID , p ) ,
newDefaultTeamPermission ( childDashboardID , p ) ,
}
}
case EDITOR :
case EDITOR :
permissionList = [ ] * models . DashboardAcl {
permissionList = [ ] * models . DashboardACL {
newEditorRolePermission ( childDashboardID , p ) ,
newEditorRolePermission ( childDashboardID , p ) ,
}
}
case VIEWER :
case VIEWER :
permissionList = [ ] * models . DashboardAcl {
permissionList = [ ] * models . DashboardACL {
newViewerRolePermission ( childDashboardID , p ) ,
newViewerRolePermission ( childDashboardID , p ) ,
}
}
}
}
@ -645,22 +645,22 @@ func (sc *scenarioContext) verifyUpdateChildDashboardPermissionsWithOverrideShou
pt . String ( ) , p . String ( ) ,
pt . String ( ) , p . String ( ) ,
)
)
sc . t . Run ( tc , func ( t * testing . T ) {
sc . t . Run ( tc , func ( t * testing . T ) {
permissionList := [ ] * models . DashboardAcl { }
permissionList := [ ] * models . DashboardACL { }
switch pt {
switch pt {
case USER :
case USER :
permissionList = [ ] * models . DashboardAcl {
permissionList = [ ] * models . DashboardACL {
newDefaultUserPermission ( childDashboardID , p ) ,
newDefaultUserPermission ( childDashboardID , p ) ,
}
}
case TEAM :
case TEAM :
permissionList = [ ] * models . DashboardAcl {
permissionList = [ ] * models . DashboardACL {
newDefaultTeamPermission ( childDashboardID , p ) ,
newDefaultTeamPermission ( childDashboardID , p ) ,
}
}
case EDITOR :
case EDITOR :
permissionList = [ ] * models . DashboardAcl {
permissionList = [ ] * models . DashboardACL {
newEditorRolePermission ( childDashboardID , p ) ,
newEditorRolePermission ( childDashboardID , p ) ,
}
}
case VIEWER :
case VIEWER :
permissionList = [ ] * models . DashboardAcl {
permissionList = [ ] * models . DashboardACL {
newViewerRolePermission ( childDashboardID , p ) ,
newViewerRolePermission ( childDashboardID , p ) ,
}
}
}
}
@ -686,9 +686,9 @@ func TestGuardianGetHiddenACL(t *testing.T) {
t . Run ( "Get hidden ACL tests" , func ( t * testing . T ) {
t . Run ( "Get hidden ACL tests" , func ( t * testing . T ) {
store := mockstore . NewSQLStoreMock ( )
store := mockstore . NewSQLStoreMock ( )
dashSvc := dashboards . NewFakeDashboardService ( t )
dashSvc := dashboards . NewFakeDashboardService ( t )
dashSvc . On ( "GetDashboardAcl InfoList" , mock . Anything , mock . AnythingOfType ( "*models.GetDashboardAcl InfoListQuery" ) ) . Run ( func ( args mock . Arguments ) {
dashSvc . On ( "GetDashboardACL InfoList" , mock . Anything , mock . AnythingOfType ( "*models.GetDashboardACL InfoListQuery" ) ) . Run ( func ( args mock . Arguments ) {
q := args . Get ( 1 ) . ( * models . GetDashboardAcl InfoListQuery )
q := args . Get ( 1 ) . ( * models . GetDashboardACL InfoListQuery )
q . Result = [ ] * models . DashboardAcl InfoDTO {
q . Result = [ ] * models . DashboardACL InfoDTO {
{ Inherited : false , UserId : 1 , UserLogin : "user1" , Permission : models . PERMISSION_EDIT } ,
{ Inherited : false , UserId : 1 , UserLogin : "user1" , Permission : models . PERMISSION_EDIT } ,
{ Inherited : false , UserId : 2 , UserLogin : "user2" , Permission : models . PERMISSION_ADMIN } ,
{ Inherited : false , UserId : 2 , UserLogin : "user2" , Permission : models . PERMISSION_ADMIN } ,
{ Inherited : true , UserId : 3 , UserLogin : "user3" , Permission : models . PERMISSION_VIEW } ,
{ Inherited : true , UserId : 3 , UserLogin : "user3" , Permission : models . PERMISSION_VIEW } ,
@ -730,13 +730,13 @@ func TestGuardianGetHiddenACL(t *testing.T) {
} )
} )
}
}
func TestGuardianGetAcl WithoutDuplicates ( t * testing . T ) {
func TestGuardianGetACL WithoutDuplicates ( t * testing . T ) {
t . Run ( "Get hidden ACL tests" , func ( t * testing . T ) {
t . Run ( "Get hidden ACL tests" , func ( t * testing . T ) {
store := mockstore . NewSQLStoreMock ( )
store := mockstore . NewSQLStoreMock ( )
dashSvc := dashboards . NewFakeDashboardService ( t )
dashSvc := dashboards . NewFakeDashboardService ( t )
dashSvc . On ( "GetDashboardAcl InfoList" , mock . Anything , mock . AnythingOfType ( "*models.GetDashboardAcl InfoListQuery" ) ) . Run ( func ( args mock . Arguments ) {
dashSvc . On ( "GetDashboardACL InfoList" , mock . Anything , mock . AnythingOfType ( "*models.GetDashboardACL InfoListQuery" ) ) . Run ( func ( args mock . Arguments ) {
q := args . Get ( 1 ) . ( * models . GetDashboardAcl InfoListQuery )
q := args . Get ( 1 ) . ( * models . GetDashboardACL InfoListQuery )
q . Result = [ ] * models . DashboardAcl InfoDTO {
q . Result = [ ] * models . DashboardACL InfoDTO {
{ Inherited : true , UserId : 3 , UserLogin : "user3" , Permission : models . PERMISSION_EDIT } ,
{ Inherited : true , UserId : 3 , UserLogin : "user3" , Permission : models . PERMISSION_EDIT } ,
{ Inherited : false , UserId : 3 , UserLogin : "user3" , Permission : models . PERMISSION_VIEW } ,
{ Inherited : false , UserId : 3 , UserLogin : "user3" , Permission : models . PERMISSION_VIEW } ,
{ Inherited : false , UserId : 2 , UserLogin : "user2" , Permission : models . PERMISSION_ADMIN } ,
{ Inherited : false , UserId : 2 , UserLogin : "user2" , Permission : models . PERMISSION_ADMIN } ,
@ -760,7 +760,7 @@ func TestGuardianGetAclWithoutDuplicates(t *testing.T) {
require . NoError ( t , err )
require . NoError ( t , err )
require . NotNil ( t , acl )
require . NotNil ( t , acl )
require . Len ( t , acl , 6 )
require . Len ( t , acl , 6 )
require . ElementsMatch ( t , [ ] * models . DashboardAcl InfoDTO {
require . ElementsMatch ( t , [ ] * models . DashboardACL InfoDTO {
{ Inherited : true , UserId : 3 , UserLogin : "user3" , Permission : models . PERMISSION_EDIT } ,
{ Inherited : true , UserId : 3 , UserLogin : "user3" , Permission : models . PERMISSION_EDIT } ,
{ Inherited : true , UserId : 4 , UserLogin : "user4" , Permission : models . PERMISSION_ADMIN } ,
{ Inherited : true , UserId : 4 , UserLogin : "user4" , Permission : models . PERMISSION_ADMIN } ,
{ Inherited : true , UserId : 6 , UserLogin : "user6" , Permission : models . PERMISSION_VIEW } ,
{ Inherited : true , UserId : 6 , UserLogin : "user6" , Permission : models . PERMISSION_VIEW } ,