示例#1
0
        public async Task Delete(params Guid[] roleIds)
        {
            foreach (var roleId in roleIds)
            {
                await _rolePermissionRepository.DeleteAllPermissions(roleId);

                var roleInDb = await _roleManager.FindByIdAsync(roleId.ToString());

                if (roleInDb.System)
                {
                    throw new LogicException("Cannot delete a system role.");
                }

                await _roleManager.DeleteAsync(roleInDb);
            }
        }