public async Task <Result <GroupAdminInviteViewModel> > GetInviteViewModel(string groupId) { List <RoleListData> canAssigneRoles = await _groupUserStore.CanAssigneRoles(); GroupAdminInviteViewModel groupAdminInviteViewModel = new GroupAdminInviteViewModel( groupId: groupId, canAssignRoles: canAssigneRoles); return(Result.Ok(groupAdminInviteViewModel)); }
public virtual async Task <Result> CanAssigneRole(string roleId) { List <RoleListData> canAssigneRoles = await _groupUserStore.CanAssigneRoles(); if (!canAssigneRoles.Any(x => x.Id == roleId)) { _logger.LogError($"User can not assign that GroupRole. GroupRoleId {roleId}"); return(Result.Fail(NO_PERMISSION)); } return(Result.Ok()); }
public async Task <Result <GroupAdminUserIndexViewModel> > GetIndexViewModel(string groupId) { List <RoleListData> canAssigneRoles = await _groupUserStore.CanAssigneRoles(); List <RoleListData> canManageRoles = await _groupUserStore.CanManageRoles(); bool canChangeOwnRole = _groupUserStore.CanChangeOwnRole(); GroupAdminUserIndexViewModel viewModel = new GroupAdminUserIndexViewModel( groupId: groupId, canMangeGroupRoles: canManageRoles, canAssigneGroupRoles: canAssigneRoles, canChangeOwnRole: canChangeOwnRole); return(Result.Ok(viewModel)); }