protected void RolesList(string action, int flowId, int processId) { IList <RoleInfo> roleListByFlowIdAndProcessId; if (action == "Modify") { roleListByFlowIdAndProcessId = RolePermissions.GetRoleListByFlowIdAndProcessId(flowId, processId); } else { roleListByFlowIdAndProcessId = RolePermissions.GetRoleListByFlowId(flowId); } if (roleListByFlowIdAndProcessId.Count == 0) { AdminPage.WriteErrMsg("<li>不能创建该流程步骤,因为可操作的角色已经被其他步骤占用或系统没有定义角色,请添加新的角色!</li>"); } if (roleListByFlowIdAndProcessId.Count > 0) { this.EChklProcessGroup.Items.Clear(); this.EChklProcessGroup.DataSource = roleListByFlowIdAndProcessId; this.EChklProcessGroup.DataTextField = "RoleName"; this.EChklProcessGroup.DataValueField = "RoleId"; this.EChklProcessGroup.DataBind(); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { // credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { int hash = 41; // Suitable nullity checks hash = hash * 59 + Id.GetHashCode(); if (Name != null) { hash = hash * 59 + Name.GetHashCode(); } if (Description != null) { hash = hash * 59 + Description.GetHashCode(); } if (RolePermissions != null) { hash = hash * 59 + RolePermissions.GetHashCode(); } if (UserRoles != null) { hash = hash * 59 + UserRoles.GetHashCode(); } return(hash); } }
/// <summary> /// Parses octal char to RolePermissions. /// </summary> public static RolePermissions ParseOctalRolePermissions(char c) { RolePermissions rolePermissions = RolePermissions.None; int value = (int)char.GetNumericValue(c); if (value < 0 || value > 7) { throw Errors.MustBeBetweenInclusive(nameof(c), 0, 7, value); } if ((value & 4) > 0) { rolePermissions |= RolePermissions.Read; } if ((value & 2) > 0) { rolePermissions |= RolePermissions.Write; } if ((value & 1) > 0) { rolePermissions |= RolePermissions.Execute; } return(rolePermissions); }
private void SaveRoleSpecialPermissions() { this.m_inputSpecialAll = ((CheckBox)this.EgvSpecial.Rows[0].FindControl("ChkSpecialInput")).Checked; this.m_manageSpecialAll = ((CheckBox)this.EgvSpecial.Rows[0].FindControl("ChkSpecialManage")).Checked; int num = 0; foreach (GridViewRow row in this.EgvSpecial.Rows) { CheckBox box = (CheckBox)row.FindControl("ChkSpecialInput"); CheckBox box2 = (CheckBox)row.FindControl("ChkSpecialManage"); HiddenField field = (HiddenField)row.FindControl("HdnSpecialId"); if ((box.Checked && (field.Value != "0")) || (this.m_inputSpecialAll && (field.Value != "0"))) { StringHelper.AppendString(this.m_inputSpecialIds, field.Value); } if ((box2.Checked && (field.Value != "0")) || (this.m_manageSpecialAll && (field.Value != "0"))) { StringHelper.AppendString(this.m_manageSpecialIds, field.Value); } if (field.Value != "0") { num++; } } AppendAllId(this.m_inputSpecialIds, num - 1); AppendAllId(this.m_manageSpecialIds, num - 1); RolePermissions.DeleteSpecialPermissionFromRoles(this.m_RoleId); RolePermissions.AddSepcialPermissionToRoles(this.m_RoleId, this.m_inputSpecialIds.ToString(), OperateCode.SpecialContentInput); RolePermissions.AddSepcialPermissionToRoles(this.m_RoleId, this.m_manageSpecialIds.ToString(), OperateCode.SepcialContentManage); }
public async Task <IEnumerable <Reply> > GetReplies(int artifactId, int discussionId, int?subArtifactId = null) { ValidateRequestParameters(artifactId, subArtifactId); if (discussionId < 1) { throw new BadRequestException(I18NHelper.FormatInvariant("Parameter: {0} is out of the range of valid values", nameof(discussionId))); } var userId = Session.UserId; var itemId = subArtifactId.HasValue ? subArtifactId.Value : artifactId; var revisionId = int.MaxValue; var isDeleted = await _artifactVersionsRepository.IsItemDeleted(itemId); var itemInfo = isDeleted ? await _artifactVersionsRepository.GetDeletedItemInfo(itemId) : await _artifactPermissionsRepository.GetItemInfo(itemId, userId, false); if (itemInfo == null || await _discussionsRepository.IsDiscussionDeleted(discussionId)) { throw new ResourceNotFoundException(); } if (subArtifactId.HasValue && itemInfo.ArtifactId != artifactId) { throw new BadRequestException("Please provide a proper subartifact Id"); } if (isDeleted) { revisionId = ((DeletedItemInfo)itemInfo).VersionId; } var permissions = await _artifactPermissionsRepository.GetArtifactPermissions(new[] { artifactId }, Session.UserId, false, revisionId); if (permissions.IsEmpty()) { permissions = await _artifactPermissionsRepository.GetArtifactPermissionDirectly(itemId, Session.UserId, itemInfo.ProjectId); } var projectPermissions = await _artifactPermissionsRepository.GetProjectPermissions(itemInfo.ProjectId); RolePermissions permission = RolePermissions.None; if (!permissions.TryGetValue(artifactId, out permission) || !permission.HasFlag(RolePermissions.Read)) { throw new AuthorizationException("You do not have permission to access the artifact"); } var result = await _discussionsRepository.GetReplies(discussionId, itemInfo.ProjectId); foreach (var reply in result) { reply.CanDelete = !projectPermissions.HasFlag(ProjectPermissions.CommentsDeletionDisabled) && permissions.TryGetValue(artifactId, out permission) && (permission.HasFlag(RolePermissions.DeleteAnyComment) || (permission.HasFlag(RolePermissions.Comment) && reply.UserId == userId)); reply.CanEdit = !projectPermissions.HasFlag(ProjectPermissions.CommentsModificationDisabled) && permissions.TryGetValue(artifactId, out permission) && (permission.HasFlag(RolePermissions.Comment) && reply.UserId == userId); } return(result); }
protected void Page_Load(object sender, EventArgs e) { if (!PEContext.Current.Admin.IsSuperAdmin) { AdminPage.WriteErrMsg("<li>本模块只有超级管理员身份才能访问!</li>"); } RolePermissions.BusinessAccessCheck(OperateCode.AdministratorManage); string str = BasePage.RequestString("UserName"); if (!string.IsNullOrEmpty(str)) { this.TxtUserName.Text = str; } if (!base.IsPostBack) { int adminId = BasePage.RequestInt32("AdminId"); this.RadPurview1.Attributes.Add("onclick", "javascript:RadPurview(0);"); this.RadPurview2.Attributes.Add("onclick", "javascript:RadPurview(1);"); this.NotBelongRoleDataBind(this.LstNotBelongRole, adminId); this.BelongToRole(this.LstBelongToRole, adminId); this.BtnSubmit.OnClientClick = "return GetBelongToRole(" + this.LstBelongToRole.ClientID + ");"; if (string.Compare(BasePage.RequestString("Action"), "Modify", StringComparison.OrdinalIgnoreCase) == 0) { this.InitModify(); } } }
protected void BtnSubmit_Click(object sender, EventArgs e) { foreach (RepeaterItem item in this.RptModelList2.Items) { Repeater repeater = item.FindControl("RptFieldList") as Repeater; HiddenField field = item.FindControl("HdnModelId") as HiddenField; if (repeater != null) { foreach (RepeaterItem item2 in repeater.Items) { CheckBox box = item2.FindControl("ChkFieldPurview") as CheckBox; HiddenField field2 = item2.FindControl("HdnFieldName") as HiddenField; if (box.Checked) { StringHelper.AppendString(this.m_modelIdList, field.Value); StringHelper.AppendString(this.m_fieldNameList, field2.Value); } } continue; } } RolePermissions.DeleteFieldPermissionFromRoles(this.m_RoleId); RolePermissions.AddFieldPermissions(this.m_RoleId, OperateCode.ContentFieldInput, this.m_modelIdList.ToString(), this.m_fieldNameList.ToString()); AdminPage.WriteSuccessMsg("<li>设置字段权限成功!</li>", "RoleManage.aspx"); }
protected void EgvRoleView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { RoleInfo dataItem = (RoleInfo)e.Row.DataItem; CheckBox box = (CheckBox)e.Row.FindControl("ChkSpecialInput"); CheckBox box2 = (CheckBox)e.Row.FindControl("ChkSpecialManage"); IList <RoleSpecialPermissionsInfo> specialPermssionList = RolePermissions.GetSpecialPermssionList(dataItem.RoleId, BasePage.RequestInt32("SpecialID")); bool flag = false; foreach (RoleSpecialPermissionsInfo info2 in specialPermssionList) { flag = info2.SpecialId != -1; if (info2.OperateCode == OperateCode.SpecialContentInput) { box.Checked = true; if (!flag) { box.Enabled = flag; } } if (info2.OperateCode == OperateCode.SepcialContentManage) { box2.Checked = true; if (!flag) { box2.Enabled = flag; } } } } }
public PSPathAccessControlEntry(AccessControlType accessControlType, RolePermissions permissions, bool defaultScope = false, string entityId = null) { this.DefaultScope = defaultScope; this.AccessControlType = accessControlType; this.EntityId = entityId; this.Permissions = permissions; }
private void AdminEditCheck(int generalId) { string str = "CanNotEdit"; if (PEContext.Current.Admin.Identity.IsAuthenticated) { int nodeId = ContentManage.GetCommonModelInfoById(generalId).NodeId; bool flag = false; if (PEContext.Current.Admin.IsSuperAdmin) { flag = true; } else { bool flag2 = false; bool flag3 = false; bool flag4 = false; flag2 = RolePermissions.AccessCheckNodePermission(OperateCode.NodeContentCheck, -1) || RolePermissions.AccessCheckNodePermission(OperateCode.NodeContentCheck, nodeId); flag3 = RolePermissions.AccessCheckNodePermission(OperateCode.NodeContentManage, -1) || RolePermissions.AccessCheckNodePermission(OperateCode.NodeContentManage, nodeId); flag4 = RolePermissions.AccessCheckNodePermission(OperateCode.NodeContentInput, -1) || RolePermissions.AccessCheckNodePermission(OperateCode.NodeContentInput, nodeId); if ((flag2 || flag4) || flag3) { flag = true; } } if (flag) { str = "OK"; } } this.XmlResponseWriter.WriteElementString("status", str); }
public void Execute(RoleDto request) { _validator.ValidateAndThrow(request); //ValidationException var exisitingPermissions = _context.RolePermissions.Where(o => o.RoleId == request.Id).ToList(); foreach (var item in exisitingPermissions) { _context.Entry(item).State = EntityState.Deleted; } var role = new Roles() { Id = request.Id, RoleName = request.RoleName }; foreach (var item in request.PerimissionIds) { var rolePermission = new RolePermissions() { PermissionId = item, RoleId = request.Id }; _context.Entry(rolePermission).State = EntityState.Added; } _context.Entry(role).State = EntityState.Modified; _context.SaveChanges(); }
private void InputRolePermission(int nodeId) { StringBuilder roleIdList = new StringBuilder(); StringBuilder builder2 = new StringBuilder(); StringBuilder builder3 = new StringBuilder(); StringBuilder builder4 = new StringBuilder(); StringBuilder builder5 = new StringBuilder(); StringBuilder builder6 = new StringBuilder(); for (int i = 0; i < this.EgvRoleView.Rows.Count; i++) { CheckBox box = (CheckBox)this.EgvRoleView.Rows[i].FindControl("ChkNodePreview"); CheckBox box2 = (CheckBox)this.EgvRoleView.Rows[i].FindControl("ChkNodeInput"); CheckBox box3 = (CheckBox)this.EgvRoleView.Rows[i].FindControl("ChkNodeCheck"); CheckBox box4 = (CheckBox)this.EgvRoleView.Rows[i].FindControl("ChkContentManage"); CheckBox box5 = (CheckBox)this.EgvRoleView.Rows[i].FindControl("ChkNodeManage"); CheckBox box6 = (CheckBox)this.EgvRoleView.Rows[i].FindControl("ChkCommentManage"); string selectId = this.EgvRoleView.DataKeys[i].Value.ToString(); AppendSelectId(box.Checked, roleIdList, selectId); AppendSelectId(box2.Checked, builder2, selectId); AppendSelectId(box3.Checked, builder3, selectId); AppendSelectId(box4.Checked, builder4, selectId); AppendSelectId(box5.Checked, builder5, selectId); AppendSelectId(box6.Checked, builder6, selectId); } RolePermissions.DeleteNodePermissionFromRoles(-1, nodeId); RolePermissions.AddNodePermissionToRoles(roleIdList.ToString(), nodeId, OperateCode.NodeContentPreview); RolePermissions.AddNodePermissionToRoles(builder2.ToString(), nodeId, OperateCode.NodeContentInput); RolePermissions.AddNodePermissionToRoles(builder3.ToString(), nodeId, OperateCode.NodeContentCheck); RolePermissions.AddNodePermissionToRoles(builder5.ToString(), nodeId, OperateCode.ChildNodesManage); RolePermissions.AddNodePermissionToRoles(builder4.ToString(), nodeId, OperateCode.NodeContentManage); RolePermissions.AddNodePermissionToRoles(builder6.ToString(), nodeId, OperateCode.NodeCommentManage); }
/// <inheritdoc/> public override int GetHashCode() { var hashCode = 2038336081; hashCode = hashCode * -1521134295 + Handle.GetHashSafe(); hashCode = hashCode * -1521134295 + SymbolicName.GetHashSafe(); hashCode = hashCode * -1521134295 + NodeId.GetHashSafe(); hashCode = hashCode * -1521134295 + NodeClass.GetHashCode(); hashCode = hashCode * -1521134295 + BrowseName.GetHashSafe(); hashCode = hashCode * -1521134295 + DisplayName.GetHashSafe(); hashCode = hashCode * -1521134295 + Description.GetHashSafe(); hashCode = hashCode * -1521134295 + WriteMask.GetHashSafe(); hashCode = hashCode * -1521134295 + UserWriteMask.GetHashSafe(); hashCode = hashCode * -1521134295 + AccessRestrictions.GetHashSafe(); hashCode = hashCode * -1521134295 + RolePermissions.GetHashSafe(); hashCode = hashCode * -1521134295 + UserRolePermissions.GetHashSafe(); return(hashCode); }
private void GetNodeCommentSelectPermission() { string selectId = ""; StringBuilder roleIdList = new StringBuilder(); StringBuilder builder2 = new StringBuilder(); StringBuilder builder3 = new StringBuilder(); this.m_ChkNodeCommentReplyAll = ((CheckBox)this.EgvNodes.Rows[0].FindControl("ChkNodeCommentReply")).Checked; this.m_ChkNodeCommentCheckAll = ((CheckBox)this.EgvNodes.Rows[0].FindControl("ChkNodeCommentCheck")).Checked; this.m_ChkNodeCommentManageAll = ((CheckBox)this.EgvNodes.Rows[0].FindControl("ChkNodeCommentManage")).Checked; for (int i = 0; i < this.EgvNodes.Rows.Count; i++) { this.m_ChkNodeCommentReply = (CheckBox)this.EgvNodes.Rows[i].Cells[2].FindControl("ChkNodeCommentReply"); this.m_ChkNodeCommentCheck = (CheckBox)this.EgvNodes.Rows[i].Cells[3].FindControl("ChkNodeCommentCheck"); this.m_ChkNodeCommentManage = (CheckBox)this.EgvNodes.Rows[i].Cells[4].FindControl("ChkNodeCommentManage"); selectId = this.EgvNodes.DataKeys[i].Value.ToString(); AppendSelectId(this.m_ChkNodeCommentReply.Checked || this.m_ChkNodeCommentReplyAll, selectId, ref roleIdList); AppendSelectId(this.m_ChkNodeCommentCheck.Checked || this.m_ChkNodeCommentCheckAll, selectId, ref builder2); AppendSelectId(this.m_ChkNodeCommentManage.Checked || this.m_ChkNodeCommentManageAll, selectId, ref builder3); } AppendAllId(roleIdList, this.EgvNodes.Rows.Count - 1); AppendAllId(builder2, this.EgvNodes.Rows.Count - 1); AppendAllId(builder3, this.EgvNodes.Rows.Count - 1); RolePermissions.DeleteNodePermissionFromRoles(this.m_RoleId, -2, OperateCode.NodeCommentReply); RolePermissions.DeleteNodePermissionFromRoles(this.m_RoleId, -2, OperateCode.NodeCommentCheck); RolePermissions.DeleteNodePermissionFromRoles(this.m_RoleId, -2, OperateCode.NodeCommentManage); RolePermissions.AddNodePermissionToRoles(this.m_RoleId, OperateCode.NodeCommentReply, roleIdList.ToString()); RolePermissions.AddNodePermissionToRoles(this.m_RoleId, OperateCode.NodeCommentCheck, builder2.ToString()); RolePermissions.AddNodePermissionToRoles(this.m_RoleId, OperateCode.NodeCommentManage, builder3.ToString()); }
private void ShowPop() { if (PEContext.Current.Admin.Identity.IsAuthenticated) { if (string.Compare(SiteConfig.SiteInfo.ProductEdition, "eshop", StringComparison.OrdinalIgnoreCase) == 0) { Order.CountByOrderStatus(OrderStatus.WaitForConfirm); Product.GetStockAlarmCount(2); Order.CountByNoConsignment(); } if (RolePermissions.AccessCheck(OperateCode.OrderConfirm)) { this.XmlResponseWriter.WriteElementString("ordercount", Order.CountByOrderStatus(OrderStatus.WaitForConfirm).ToString()); } this.XmlResponseWriter.WriteElementString("messagecount", Message.UnreadMessageCount(PEContext.Current.Admin.UserName).ToString()); if (RolePermissions.AccessCheck(OperateCode.ContentManage)) { this.XmlResponseWriter.WriteElementString("articlestatuscount", ContentManage.GetCountByStatus(0).ToString()); } if (RolePermissions.AccessCheck(OperateCode.CommentManage)) { this.XmlResponseWriter.WriteElementString("commentcount", Comment.GetCountByStatus(2).ToString()); } this.XmlResponseWriter.WriteElementString("articlesignincount", ContentManage.GetCountBySignIn(PEContext.Current.Admin.UserName, false).ToString()); if (RolePermissions.AccessCheck(OperateCode.StockManage)) { this.XmlResponseWriter.WriteElementString("productstockalarmcount", Product.GetStockAlarmCount(2).ToString()); } if (RolePermissions.AccessCheck(OperateCode.OrderSendOrReturnGoods)) { this.XmlResponseWriter.WriteElementString("ordercountbynoconsignment", Order.CountByNoConsignment().ToString()); } } }
public static bool DeleteSpecialById(int specialId) { RolePermissions.AccessCheck(OperateCode.SpecialManage); DeleteFolder(specialId); DeleteSpecialInfoBySpecialId(specialId); return(dal.DeleteSpecial(specialId)); }
public PSPathAccessControlEntry(PathAccessControlItem acl) { this.DefaultScope = acl.DefaultScope; this.AccessControlType = acl.AccessControlType; this.EntityId = acl.EntityId; this.Permissions = acl.Permissions; }
private static void SpecialSelectXml(XTreeCollection xTreeList) { if (DataConverter.CLng(HttpContext.Current.Request.QueryString["SpecialCategoryID"]) <= 0) { foreach (SpecialCategoryInfo info in Special.GetSpecialCategoryList()) { string str = "javascript:category();"; string str2 = ""; if (Special.ExistsSpecialCategoryIdInSpecials(info.SpecialCategoryId)) { str2 = "SpecialSelectTreeXml.aspx?Action=SpecialSelect&SpecialCategoryID=" + info.SpecialCategoryId; } XTreeItem item = new XTreeItem(); item.Text = "[专题类别]" + info.SpecialCategoryName; item.ArrModelId = "1"; item.ArrModelName = ""; item.Icon = "Container"; item.NodeId = info.SpecialCategoryId.ToString(); item.Target = ""; item.Expand = "0"; item.AnchorType = "1"; item.XmlSrc = str2; item.Action = str; xTreeList.Add(item); } } else { foreach (SpecialInfo info2 in Special.GetSpecialList(DataConverter.CLng(HttpContext.Current.Request.QueryString["SpecialCategoryID"]))) { string str3 = "javascript:going(" + info2.SpecialId.ToString() + ");"; XTreeItem item2 = new XTreeItem(); item2.Text = info2.SpecialName; item2.ArrModelId = "0"; item2.ArrModelName = ""; item2.NodeId = info2.SpecialId.ToString(); item2.Icon = "Container"; item2.Target = ""; item2.Expand = "0"; if (!PEContext.Current.Admin.IsSuperAdmin) { if (RolePermissions.AccessCheckSpecialPermission(OperateCode.SpecialContentInput, info2.SpecialId)) { item2.AnchorType = "1"; } else { item2.AnchorType = "0"; } } else { item2.AnchorType = "1"; } item2.XmlSrc = ""; item2.Action = str3; xTreeList.Add(item2); } } }
/// <summary> /// /// </summary> /// <param name="context"></param> /// <param name="actionId"></param> /// <returns></returns> public bool HasPermission(ActionExecutingContext context, string actionId) { var identity = (context.HttpContext.User.Identity as MvcIdentity); if (identity.IsAuthenticated) { var role = RolePermissions.SingleOrDefault(x => x.Id == identity.RoleId); if (role != null && role.Menus.Contains(actionId)) { return(true); } if (context.HttpContext.IsAjaxRequest()) { Result result = new Result(); result.SetStatus(ErrorCode.Forbidden); context.Result = new ObjectResult(result); } else { var view = new ViewResult(); view.ViewName = "~/Views/Home/Welcome.cshtml"; context.Result = view; } return(false); } return(true); }
protected void Page_Load(object sender, EventArgs e) { RolePermissions.BusinessAccessCheck(OperateCode.SpecialManage); this.specialId = BasePage.RequestInt32("SpecialID"); this.specialCategoryId = BasePage.RequestInt32("SpecialCategoryID"); this.InitialText(); }
/// <summary> /// Returns a list of Role Permissions and their respective labels. If no (DisplayName) attribute present, will NOT be added to list. /// </summary> /// <param name="rp"></param> /// <returns></returns> public static Dictionary<string, bool> GetRolePermissionsList(RolePermissions rp) { var kvp = new Dictionary<string, bool>(); if (rp == null) { return kvp; } foreach (var prop in rp.GetType().GetProperties()) { // User Reflection to get custom atttributes Attribute[] attrs = System.Attribute.GetCustomAttributes(prop); var attr = attrs.FirstOrDefault(); string DisplayName; if (attr is DisplayAttribute) { var dispAttr = (DisplayAttribute)attr; DisplayName = dispAttr.Name; bool value = (bool)prop.GetValue(rp, null); kvp.Add(DisplayName, value); } } return kvp; }
private void GetContentNodeSelectPermission() { string selectId = ""; StringBuilder roleIdList = new StringBuilder(); StringBuilder builder2 = new StringBuilder(); StringBuilder builder3 = new StringBuilder(); StringBuilder builder4 = new StringBuilder(); this.m_NodePreviewAll = ((CheckBox)this.EgvContents.Rows[0].FindControl("ChkNodePreview")).Checked; this.m_NodeInputAll = ((CheckBox)this.EgvContents.Rows[0].FindControl("ChkNodeInput")).Checked; this.m_NodeCheckAll = ((CheckBox)this.EgvContents.Rows[0].FindControl("ChkNodeCheck")).Checked; this.m_ContentManageAll = ((CheckBox)this.EgvContents.Rows[0].FindControl("ChkContentManage")).Checked; for (int i = 0; i < this.EgvContents.Rows.Count; i++) { this.m_ChkNodePreview = (CheckBox)this.EgvContents.Rows[i].Cells[2].FindControl("ChkNodePreview"); this.m_ChkNodeInput = (CheckBox)this.EgvContents.Rows[i].Cells[3].FindControl("ChkNodeInput"); this.m_ChkNodeCheck = (CheckBox)this.EgvContents.Rows[i].Cells[4].FindControl("ChkNodeCheck"); this.m_ChkContentManage = (CheckBox)this.EgvContents.Rows[i].Cells[5].FindControl("ChkContentManage"); selectId = this.EgvContents.DataKeys[i].Value.ToString(); AppendSelectId(this.m_ChkNodePreview.Checked || this.m_NodePreviewAll, selectId, ref roleIdList); AppendSelectId(this.m_ChkNodeInput.Checked || this.m_NodeInputAll, selectId, ref builder2); AppendSelectId(this.m_ChkNodeCheck.Checked || this.m_NodeCheckAll, selectId, ref builder3); AppendSelectId(this.m_ChkContentManage.Checked || this.m_ContentManageAll, selectId, ref builder4); } RolePermissions.AddNodePermissionToRoles(this.m_RoleId, OperateCode.NodeContentPreview, roleIdList.ToString()); RolePermissions.AddNodePermissionToRoles(this.m_RoleId, OperateCode.NodeContentInput, builder2.ToString()); RolePermissions.AddNodePermissionToRoles(this.m_RoleId, OperateCode.NodeContentCheck, builder3.ToString()); RolePermissions.AddNodePermissionToRoles(this.m_RoleId, OperateCode.NodeContentManage, builder4.ToString()); }
protected override void CreateChildControls() { Control child = this.Page.LoadControl("~/Controls/FieldControl/" + this.ControlType.ToString() + ".ascx"); child.ID = "EasyOne2007"; if (this.IsAdminManage) { this.Visible = RolePermissions.AccessCheckFieldPermission(OperateCode.ContentFieldInput, DataConverter.CLng(HttpContext.Current.Request.QueryString["ModelId"]), this.FieldName); } else { this.Visible = UserPermissions.AccessCheck(OperateCode.ContentFieldInput, DataConverter.CLng(HttpContext.Current.Request.QueryString["ModelId"]), this.FieldName); } this.m_FieldControl = (IFieldControl)child; this.m_FieldControl.Settings = this.Settings; this.m_FieldControl.EnableNull = this.EnableNull; this.m_FieldControl.FieldAlias = this.FieldAlias; this.m_FieldControl.FieldLevel = this.FieldLevel; this.m_FieldControl.FieldName = this.FieldName; this.m_FieldControl.Tips = this.Tips; this.m_FieldControl.Description = this.Description; this.m_FieldControl.ControlType = this.ControlType; this.m_FieldControl.IsAdminManage = this.IsAdminManage; this.m_FieldControl.InitFieldControl(); this.Controls.Add(child); }
private static void GetSearchNodeIds(int nodeId, ref string nodeIds) { nodeIds = GetNodeArrChildId(nodeId); if (string.IsNullOrEmpty(nodeIds) && !PEContext.Current.Admin.IsSuperAdmin) { nodeIds = RolePermissions.GetRoleAllNodeId(PEContext.Current.Admin.Roles); } }
protected override void OnInit(EventArgs e) { base.OnInit(e); if (!RolePermissions.AccessCheck(OperateCode.UserModifyPermissions)) { throw new CustomException(PEExceptionType.ExceedAuthority); } }
private static void DeleteNodeRelationByNodeId(int nodeId) { RolePermissions.DeleteNodePermissionFromRoles(-1, nodeId); UserPermissions.DeleteNodePermissionsByNodeId(nodeId, OperateCode.None); ModelManager.DeleteNodeModel(nodeId); ModelManager.DeleteNodeTemplateId(nodeId); ModelManager.DeleteNodesModelTemplateRelationShip(nodeId); }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { RolePermissions.BusinessAccessCheck(OperateCode.CreateHtmlManage); this.ListDataBind(this.LstNodes); } }
private void VanillaSetRolePermissions(RolePermissions Role) { if (!File.Exists($"./data/role-permissions/{Role.SnowflakeIdentifier}.json")) { CreateRolePermissions(Role.SnowflakeIdentifier); } RolePermissions.Serialize(Role); }
private RolePermissions VanillaGetRolePermissions(UInt64 RoleId) { if (!File.Exists($"./data/role-permissions/{RoleId}.json")) { CreateRolePermissions(RoleId); } return(RolePermissions.Deserialize(RoleId).Update(DefaultPermissions.Deserialize())); }
static async Task ApplyACLsForFile(DataLakeFileClient fileClient, RolePermissions newACLs, AppSettings settings) { PathAccessControl fileAccessControl = await fileClient.GetAccessControlAsync(); List <PathAccessControlItem> accessControlList = UpdateACLs(fileAccessControl.AccessControlList, newACLs, settings); await fileClient.SetAccessControlListAsync(accessControlList); }
/// <summary> /// Removes a permission from this role instance. /// </summary> /// <param name="permission">The permission to remove.</param> public void RemovePermission(Permission permission) { var permissionToRemove = RolePermissions.FirstOrDefault(x => x.Permission.Code == permission.Code); if (permissionToRemove != null) { RolePermissions.Remove(permissionToRemove); } }
public static void AddUpdateRole(string roleName, bool hasRead, bool hasEdit, bool hasPublish) { RolePermissions permissions = new RolePermissions(); permissions.RoleName = roleName; permissions.HasRead = hasRead; permissions.HasEdit = hasEdit; permissions.HasPublish = hasPublish; permissions.Save(); RolePermissionManager.MarkDirty(); // Add role to other membership databases controller.AddRole(roleName); }