set guest user to have permission to view machines

master
Tudor Stanciu 2023-04-18 02:53:05 +03:00
parent 5a8af94ad7
commit 5cdf5e804f
2 changed files with 7 additions and 3 deletions

View File

@ -35,12 +35,16 @@ if not exists (select top 1 1 from PermissionHierarchy)
begin begin
declare @view_machines_permission_id int, declare @view_machines_permission_id int,
@manage_machines_permission_id int, @manage_machines_permission_id int,
@operate_machines_permission_id int @operate_machines_permission_id int,
@guest_access_permission_id int
select @view_machines_permission_id = PermissionId from Permission where PermissionCode = 'VIEW_MACHINES' select @view_machines_permission_id = PermissionId from Permission where PermissionCode = 'VIEW_MACHINES'
select @manage_machines_permission_id = PermissionId from Permission where PermissionCode = 'MANAGE_MACHINES' select @manage_machines_permission_id = PermissionId from Permission where PermissionCode = 'MANAGE_MACHINES'
select @operate_machines_permission_id = PermissionId from Permission where PermissionCode = 'OPERATE_MACHINES' select @operate_machines_permission_id = PermissionId from Permission where PermissionCode = 'OPERATE_MACHINES'
select @guest_access_permission_id = PermissionId from Permission where PermissionCode = 'GUEST_ACCESS'
insert into PermissionHierarchy (ParentPermissionId, ChildPermissionId) insert into PermissionHierarchy (ParentPermissionId, ChildPermissionId)
values (@manage_machines_permission_id, @view_machines_permission_id), (@operate_machines_permission_id, @view_machines_permission_id) values (@manage_machines_permission_id, @view_machines_permission_id),
(@operate_machines_permission_id, @view_machines_permission_id),
(@guest_access_permission_id, @view_machines_permission_id)
end end

View File

@ -6,6 +6,6 @@ namespace NetworkResurrector.Api.Authorization.Requirements
public class ViewMachinesRequirement : IPermissionsBasedAuthorizationRequirement public class ViewMachinesRequirement : IPermissionsBasedAuthorizationRequirement
{ {
public string[] AllRequired => Array.Empty<string>(); public string[] AllRequired => Array.Empty<string>();
public string[] OneOf => new string[] { PermissionCodes.VIEW_MACHINES, PermissionCodes.GUEST_ACCESS }; public string[] OneOf => new string[] { PermissionCodes.VIEW_MACHINES };
} }
} }