| | |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Model.Models.System; |
| | | using WIDESEA_SystemRepository; |
| | | using WIDESEA_Core.Helper; |
| | | |
| | | namespace WIDESEA_SystemService |
| | | { |
| | |
| | | return list; |
| | | } |
| | | |
| | | public List<RoleNodes> GetAllRoleId() |
| | | public List<RoleNodes> GetAllRoleId() |
| | | { |
| | | List<RoleNodes> roles = BaseDal.QueryData().Select(s => new RoleNodes() { Id = s.RoleId, ParentId = s.ParentId, RoleName = s.RoleName }).ToList(); |
| | | |
| | |
| | | { |
| | | return GetUserTreePermission(App.User.RoleId); |
| | | } |
| | | public override WebResponseContent UpdateData(SaveModel saveModel) |
| | | { |
| | | var ParentId = saveModel.MainData[nameof(Sys_Role.ParentId).FirstLetterToLower()].ObjToInt();//ç¶çº§ID |
| | | var RoleId = saveModel.MainData[nameof(Sys_Role.RoleId).FirstLetterToLower()].ObjToInt();//è§è²ID |
| | | if (RoleId == ParentId) return WebResponseContent.Instance.Error("ç¶çº§IDä¸è½ä¸ºèªå·±"); |
| | | if (App.User.RoleId == RoleId) return WebResponseContent.Instance.Error("æ æä½æé"); |
| | | return base.UpdateData(saveModel); |
| | | } |
| | | |
| | | public override PageGridData<Sys_Role> GetPageData(PageDataOptions options) |
| | | { |
| | | PageGridData<Sys_Role> pageGridData = new PageGridData<Sys_Role>(); |
| | | if (App.User.IsSuperAdmin) |
| | | { |
| | | var GridData = base.GetPageData(options); |
| | | pageGridData = new PageGridData<Sys_Role>() |
| | | { |
| | | Rows = options.Order?.ToLower() == OrderByType.Asc.ToString().ToLower() ? GridData.Rows.OrderBy(x => x.RoleId).ToList() : GridData.Rows, |
| | | Total = GridData.Total |
| | | }; |
| | | return pageGridData; |
| | | } |
| | | |
| | | var roleIds = GetAllChildren(App.User.RoleId).Select(x => x.Id); |
| | | //æ å½¢èåä¼ æ¥è¯¢è§è²ä¸ææç¨æ· |
| | | string where = ValidatePageOptions(options); |
| | | |
| | | int total = 0; |
| | | pageGridData = new PageGridData<Sys_Role>() |
| | | { |
| | | Rows = BaseDal.Db.Queryable<Sys_Role>().Where(x => roleIds.Contains(x.RoleId)).Where(where).OrderBy(x => x.RoleId).ToPageList(options.Page, options.Rows), |
| | | Total = total |
| | | }; |
| | | |
| | | return pageGridData; |
| | | } |
| | | /// <summary> |
| | | /// ç¼è¾æéæ¶ï¼è·åæå®è§è²çææèåæé |
| | | /// </summary> |
| | |
| | | //è·åç¨æ·æé |
| | | List<Permissions> permissions = _MenuRepository.GetPermissions(roleId); |
| | | //æéç¨æ·æéæ¥è¯¢ææçèåä¿¡æ¯ |
| | | List<MenuDTO> menus = _MenuService.GetUserMenuList(roleId); |
| | | List<MenuDTO> menus = _MenuService.GetUserMenuList(roleId); |
| | | //è·åå½åç¨æ·æéå¦:(Add,Search)对åºçæ¾ç¤ºææ¬ä¿¡æ¯å¦:Addï¼æ·»å ï¼Search:æ¥è¯¢ |
| | | var data = menus.Select(x => new |
| | | { |
| | |
| | | string message = ""; |
| | | try |
| | | { |
| | | if (!GetAllChildren(App.User.RoleId).Exists(x => x.Id == roleId)) |
| | | var RoleNodes = GetAllChildren(App.User.RoleId); |
| | | RoleNodes = RoleNodes.Where(x => x.Id != App.User.RoleId).ToList(); |
| | | if (!RoleNodes.Exists(x => x.Id == roleId) /*&& !App.User.IsRoleIdSuperAdmin(App.User.RoleId)*/) |
| | | return WebResponseContent.Instance.Error("没ææéä¿®æ¹æ¤è§è²çæéä¿¡æ¯"); |
| | | //å½åç¨æ·çæé |
| | | List<Permissions> permissions = _MenuRepository.GetPermissions(App.User.RoleId); |
| | |
| | | |
| | | } |
| | | //æ´æ°æé |
| | | _RoleAuthRepository.UpdateData(updateAuths); |
| | | _RoleAuthRepository.UpdateData(updateAuths.Where(x => x.AuthId > 0).ToList()); |
| | | //æ°å¢çæé |
| | | _RoleAuthRepository.AddData(updateAuths); |
| | | _RoleAuthRepository.AddData(updateAuths.Where(x => x.AuthId <= 0).ToList()); |
| | | |
| | | //è·åæéåæ¶çæé |
| | | int[] authIds = roleAuths.Where(x => userPermissions.Select(u => u.Id) |
| | |
| | | x.AuthValue = ""; |
| | | }); |
| | | //å°åæ¶çæé设置为"" |
| | | _RoleAuthRepository.UpdateData(delAuths); |
| | | _RoleAuthRepository.DeleteData(delAuths); |
| | | |
| | | int addCount = updateAuths.Where(x => x.AuthId <= 0).Count(); |
| | | int updateCount = updateAuths.Where(x => x.AuthId > 0).Count(); |
| | | |
| | | |
| | | string _version = DateTime.Now.ToString("yyyyMMddHHMMssfff"); |
| | | |
| | | |