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));
        }
예제 #2
0
        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());
        }
예제 #3
0
        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));
        }