loggedInUserScenarioWithRole("When calling GET on","GET","/api/folders/uid/permissions","/api/folders/:uid/permissions",m.ROLE_EDITOR,func(sc*scenarioContext){
callGetFolderPermissions(sc)
So(sc.resp.Code,ShouldEqual,403)
})
cmd:=dtos.UpdateDashboardAclCommand{
Items:[]dtos.DashboardAclUpdateItem{
{UserId:1000,Permission:m.PERMISSION_ADMIN},
},
}
updateFolderPermissionScenario("When calling POST on","/api/folders/uid/permissions","/api/folders/:uid/permissions",cmd,func(sc*scenarioContext){
callUpdateFolderPermissions(sc)
So(sc.resp.Code,ShouldEqual,403)
})
Reset(func(){
guardian.New=origNewGuardian
dashboards.NewFolderService=origNewFolderService
})
})
Convey("Given user has admin permissions and permissions to update",func(){
loggedInUserScenarioWithRole("When calling GET on","GET","/api/folders/uid/permissions","/api/folders/:uid/permissions",m.ROLE_ADMIN,func(sc*scenarioContext){
callGetFolderPermissions(sc)
So(sc.resp.Code,ShouldEqual,200)
})
cmd:=dtos.UpdateDashboardAclCommand{
Items:[]dtos.DashboardAclUpdateItem{
{UserId:1000,Permission:m.PERMISSION_ADMIN},
},
}
updateFolderPermissionScenario("When calling POST on","/api/folders/uid/permissions","/api/folders/:uid/permissions",cmd,func(sc*scenarioContext){