public IActionResult PrivilegeResource() { var data = _entityPermissionService.Query(x => x.Select(s => new { s.EntityPermissionId, s.AccessRight, s.EntityId })); if (data.NotEmpty()) { var result = new List <PrivilegeResourceItem>(); var entities = _entityFinder.FindAll().Where(x => x.AuthorizationEnabled); foreach (var item in entities) { var views = data.Where(x => x.EntityId == item.EntityId); if (!views.Any()) { continue; } var group1 = new PrivilegeResourceItem(); group1.Label = item.LocalizedName; group1.Children = views.Select(x => (new PrivilegeResourceItem { Id = x.EntityPermissionId, Label = T["security_" + Enum.GetName(typeof(AccessRightValue), x.AccessRight)], AuthorizationEnabled = true })).ToList(); result.Add(group1); } return(JOk(result)); } return(JOk()); }
public IActionResult PrivilegeResource(bool?authorizationEnabled) { FilterContainer <QueryView.Domain.QueryView> filter = FilterContainerBuilder.Build <QueryView.Domain.QueryView>(); filter.And(x => x.StateCode == RecordState.Enabled && x.IsDefault == false && x.IsPrivate == false); if (authorizationEnabled.HasValue) { filter.And(x => x.AuthorizationEnabled == authorizationEnabled); } var data = _queryViewFinder.Query(x => x.Select(s => new { s.QueryViewId, s.Name, s.EntityId, s.AuthorizationEnabled }).Where(filter)); if (data.NotEmpty()) { var result = new List <PrivilegeResourceItem>(); var entities = _entityFinder.FindAll()?.OrderBy(x => x.LocalizedName).ToList(); foreach (var item in entities) { var views = data.Where(x => x.EntityId == item.EntityId); if (!views.Any()) { continue; } var group1 = new PrivilegeResourceItem { Label = item.LocalizedName, Children = views.Select(x => (new PrivilegeResourceItem { Id = x.QueryViewId, Label = x.Name, AuthorizationEnabled = x.AuthorizationEnabled })).ToList() }; result.Add(group1); } return(JOk(result)); } return(JOk()); }
public IActionResult SolutionComponents([FromQuery] GetSolutionComponentsModel model) { var data = _entityMapFinder.QueryPaged(x => x.Page(model.Page, model.PageSize), model.SolutionId, model.InSolution); if (data.Items.NotEmpty()) { var entities = _entityFinder.FindAll(); var result = data.Items.Select(x => (new SolutionComponentItem { ObjectId = x.EntityMapId, Name = x.SourceEnttiyName + "-" + x.TargetEnttiyName, LocalizedName = (entities.Find(e => e.EntityId == x.SourceEntityId).LocalizedName + "-" + entities.Find(e => e.EntityId == x.TargetEntityId).LocalizedName), ComponentTypeName = DataMappingDefaults.ModuleName, CreatedOn = x.CreatedOn })).ToList(); return(JOk(new PagedList <SolutionComponentItem>() { CurrentPage = model.Page , ItemsPerPage = model.PageSize , Items = result , TotalItems = data.TotalItems , TotalPages = data.TotalPages })); } return(JOk(data)); }
public IActionResult PrivilegeResource() { var data = _workFlowFinder.Query(x => x.Select(s => new { s.WorkFlowId, s.Name, s.EntityId, s.AuthorizationEnabled }).Where(f => f.StateCode == Core.RecordState.Enabled)); if (data.NotEmpty()) { var result = new List <PrivilegeResourceItem>(); var entities = _entityFinder.FindAll(); foreach (var item in entities) { var attributes = data.Where(x => x.EntityId == item.EntityId); if (!attributes.Any()) { continue; } var group1 = new PrivilegeResourceItem(); group1.Label = item.LocalizedName; group1.Children = attributes.Select(x => (new PrivilegeResourceItem { Id = x.WorkFlowId, Label = x.Name, AuthorizationEnabled = x.AuthorizationEnabled })).ToList(); result.Add(group1); } return(JOk(result)); } return(JOk()); }
public IActionResult PrivilegeResource(bool?authorizationEnabled) { FilterContainer <Schema.Domain.Attribute> filter = FilterContainerBuilder.Build <Schema.Domain.Attribute>(); filter.And(x => x.AttributeTypeName != AttributeTypeIds.PRIMARYKEY && x.Name.NotIn(AttributeDefaults.SystemAttributes)); if (authorizationEnabled.HasValue) { filter.And(x => x.AuthorizationEnabled == authorizationEnabled); } var data = _attributeFinder.Query(x => x.Select(s => new { s.AttributeId, s.LocalizedName, s.EntityId, s.AuthorizationEnabled }) .Where(filter) .Sort(s => s.SortAscending(f => f.Name)) ); if (data.NotEmpty()) { var result = new List <PrivilegeResourceItem>(); var entities = _entityFinder.FindAll()?.Where(x => x.IsCustomizable).OrderBy(x => x.LocalizedName).ToList(); foreach (var item in entities) { var attributes = data.Where(x => x.EntityId == item.EntityId); if (!attributes.Any()) { continue; } var group1 = new PrivilegeResourceItem { Label = item.LocalizedName, Children = attributes.Select(x => (new PrivilegeResourceItem { Id = x.AttributeId, Label = x.LocalizedName, AuthorizationEnabled = x.AuthorizationEnabled })).ToList() }; result.Add(group1); } return(JOk(result)); } return(JOk()); }
public IActionResult PrivilegeResource(bool?authorizationEnabled) { FilterContainer <RibbonButton.Domain.RibbonButton> filter = FilterContainerBuilder.Build <RibbonButton.Domain.RibbonButton>(); filter.And(x => x.StateCode == RecordState.Enabled); if (authorizationEnabled.HasValue) { filter.And(x => x.AuthorizationEnabled == authorizationEnabled); } var data = _ribbonButtonFinder.Query(x => x.Select(s => new { s.RibbonButtonId, s.Label, s.ShowArea, s.EntityId, s.AuthorizationEnabled }).Where(filter)); if (data.NotEmpty()) { var result = new List <PrivilegeResourceItem>(); var entities = _entityFinder.FindAll()?.OrderBy(x => x.LocalizedName).ToList(); foreach (var item in entities) { var entityButtons = data.Where(x => x.EntityId == item.EntityId); if (!entityButtons.Any()) { continue; } var childrens = new List <PrivilegeResourceItem>(); var group1 = new PrivilegeResourceItem(); group1.Label = item.LocalizedName; var formButtons = entityButtons.Where(x => x.ShowArea == RibbonButtonArea.Form).Select(x => (new PrivilegeResourceItem { Id = x.RibbonButtonId, Label = x.Label, AuthorizationEnabled = x.AuthorizationEnabled })).ToList(); if (formButtons.NotEmpty()) { var groupForm = new PrivilegeResourceItem { Label = "表单", Children = formButtons }; childrens.Add(groupForm); } var listHeaderButtons = entityButtons.Where(x => x.ShowArea == RibbonButtonArea.ListHead).Select(x => (new PrivilegeResourceItem { Id = x.RibbonButtonId, Label = x.Label, AuthorizationEnabled = x.AuthorizationEnabled })).ToList();; if (listHeaderButtons.NotEmpty()) { var groupListHeader = new PrivilegeResourceItem { Label = "列表头部", Children = listHeaderButtons }; childrens.Add(groupListHeader); } var listRowButtons = entityButtons.Where(x => x.ShowArea == RibbonButtonArea.ListRow).Select(x => (new PrivilegeResourceItem { Id = x.RibbonButtonId, Label = x.Label, AuthorizationEnabled = x.AuthorizationEnabled })).ToList(); if (listRowButtons.NotEmpty()) { var groupListRow = new PrivilegeResourceItem { Label = "列表行内", Children = listRowButtons }; childrens.Add(groupListRow); } var subGridButtons = entityButtons.Where(x => x.ShowArea == RibbonButtonArea.SubGrid).Select(x => (new PrivilegeResourceItem { Id = x.RibbonButtonId, Label = x.Label })).ToList(); if (subGridButtons.NotEmpty()) { var groupSubGrid = new PrivilegeResourceItem { Label = "单据体", Children = subGridButtons }; childrens.Add(groupSubGrid); } group1.Children = childrens; result.Add(group1); } return(JOk(result)); } return(JOk()); }