Esempio n. 1
0
        public async Task <ListResp <GetRoleItemResp> > GetAuthUserFuncList()
        {
            var memIdentityRes = await AdminHelper.GetAuthAdmin();

            if (!memIdentityRes.IsSuccess())
            {
                return(new ListResp <GetRoleItemResp>().WithResp(memIdentityRes));
            }

            // 如果是超级管理员直接返回所有
            if (memIdentityRes.data.auth_type != PortalAuthorizeType.SuperAdmin)
            {
                return(await FuncHelper.GetAuthUserRoleFuncList());
            }

            var sysFunItemsRes = await FuncHelper.GetAllFuncItems();

            if (!sysFunItemsRes.IsSuccess())
            {
                return(new ListResp <GetRoleItemResp>().WithResp(sysFunItemsRes));
            }

            var roleItems = sysFunItemsRes.data.Select(item => item.ToRoleItemResp()).ToList();

            return(new ListResp <GetRoleItemResp>(roleItems));
        }