/// <summary> /// /// </summary> /// <returns></returns> public async Task <IList <PermissionViewModel> > GetPermissionsAsync() { // Process var permissions = AccessPermissionManager.GetAsSelectListItems(); // Result return(permissions); }
/// <summary> /// </summary> /// <param name="viewModel"></param> public async Task <RoleEditViewModel> FillForEditAsync(RoleEditViewModel viewModel) { // Process var permissions = AccessPermissionManager.GetAsSelectListItems(); // Result return(viewModel); }
/// <summary> /// /// </summary> /// <param name="roleId"></param> /// <returns></returns> public async Task <IList <PermissionViewModel> > GetPermissionsByRoleIdAsync(Guid roleId) { // Process var permissions = AccessPermissionManager.GetAsSelectListItems(); var role = await _roles.FirstOrDefaultAsync(model => model.Id == roleId); var document = XDocument.Parse(role.Permissions); var rolePermissions = permissions.Select(model => new PermissionViewModel { Id = model.Id, ParentId = model.ParentId, Title = model.Title, Audit = model.Audit, IsSelect = document.Descendants("Permission").Any(m => m.Value == model.Id) }).ToList(); // Result return(rolePermissions); }