コード例 #1
0
        /// <summary>
        /// 获取角色菜单
        /// </summary>
        /// <param name="applicationId">应用程序标识</param>
        /// <param name="roleId">角色标识</param>
        public async Task <List <SelectModuleResponse> > GetRoleMenusAsync(Guid applicationId, Guid roleId)
        {
            var role = await RoleRepository.FindAsync(roleId);

            var roleIds = new List <Guid>()
            {
                roleId, role.ParentId.SafeValue()
            };
            var modules = await ModuleRepository.GetModulesAsync(applicationId, roleIds);

            var operations = await OperationRepository.GetOperationsAsync(applicationId, roleIds);

            var permissions = await PermissionRepository.GetResourceIdsAsync(applicationId, roleId, false);

            var result = new SelectMenuResult(modules, operations, permissions);

            return(result.GetResult());
        }