protected void Page_Load(object sender, EventArgs e) { // Add event handling usRoles.OnItemsSelected += usRoles_OnItemsSelected; // Check if document is owned by group if (GroupID > 0) { if (NodeID > 0) { usRoles.SetValue("GroupID", GroupID.ToString()); } else { usRoles.WhereCondition = "RoleGroupID=" + GroupID; } } else { usRoles.WhereCondition = SqlHelper.AddWhereCondition(usRoles.WhereCondition, "RoleGroupID IS NULL"); } // Check if site filter should be displayed if (ShowSiteFilter) { usRoles.SetValue("DefaultFilterValue", SiteContext.CurrentSiteID); usRoles.SetValue("FilterMode", "role"); usRoles.SetValue("ShowSiteFilter", true); usRoles.FilterControl = "~/CMSFormControls/Filters/SiteFilter.ascx"; } else { usRoles.WhereCondition = SqlHelper.AddWhereCondition(usRoles.WhereCondition, "(SiteID IS NULL OR SiteID = " + SiteContext.CurrentSiteID + ")"); } // Check node permissions if (Node != null) { // Check if filter should be used if ((GroupID > 0) || ShowSiteFilter) { // Add sites filter usRoles.FilterControl = "~/CMSFormControls/Filters/SiteGroupFilter.ascx"; usRoles.SetValue("FilterMode", "role"); } // Allow group administrator edit group document permissions on live site if ((GroupID > 0) && IsLiveSite) { if (MembershipContext.AuthenticatedUser.IsGroupAdministrator(GroupID)) { usRoles.Enabled = true; return; } } if (MembershipContext.AuthenticatedUser.IsAuthorizedPerDocument(Node, NodePermissionsEnum.ModifyPermissions) != AuthorizationResultEnum.Allowed) { usRoles.Enabled = false; return; } } // Check bizform 'EditForm' permission if (FormID > 0) { if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("cms.form", "EditForm")) { usRoles.Enabled = false; return; } } // Check poll permission if (PollID > 0) { if (GroupID > 0) { if (!MembershipContext.AuthenticatedUser.IsGroupAdministrator(GroupID)) { usRoles.Enabled = false; return; } } else { if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("cms.polls", "Modify")) { usRoles.Enabled = false; return; } } } // Check message board permission if (BoardID > 0) { GeneralizedInfo boardObj = ModuleCommands.MessageBoardGetMessageBoardInfo(BoardID); if (boardObj != null) { int boardGroupId = ValidationHelper.GetInteger(boardObj.GetValue("BoardGroupID"), 0); if (boardGroupId > 0) { if (!MembershipContext.AuthenticatedUser.IsGroupAdministrator(boardGroupId)) { usRoles.Enabled = false; return; } } else if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.MessageBoards", "Modify")) { usRoles.Enabled = false; return; } } } if (!IsLiveSite) { ScriptHelper.RegisterDialogScript(Page); } }
protected void Page_Load(object sender, EventArgs e) { // Add event handling usUsers.UniSelector.OnItemsSelected += usUsers_OnItemsSelected; usUsers.UniSelector.OnSelectionChanged += usUsers_OnItemsSelected; // Check node permissions if (Node != null) { // Set group filter if (GroupID > 0) { usUsers.UniSelector.FilterControl = "~/CMSFormControls/Filters/SiteGroupFilter.ascx"; usUsers.UniSelector.SetValue("GroupID", GroupID.ToString()); } // Allow group administrator edit group document permissions on live site if ((GroupID > 0) && IsLiveSite) { if (MembershipContext.AuthenticatedUser.IsGroupAdministrator(GroupID)) { usUsers.Enabled = true; return; } } if (MembershipContext.AuthenticatedUser.IsAuthorizedPerDocument(Node, NodePermissionsEnum.ModifyPermissions) != AuthorizationResultEnum.Allowed) { usUsers.Enabled = false; return; } } // Check message board permission if (BoardID > 0) { GeneralizedInfo boardObj = ModuleCommands.MessageBoardGetMessageBoardInfo(BoardID); if (boardObj != null) { int boardGroupId = ValidationHelper.GetInteger(boardObj.GetValue("BoardGroupID"), 0); if (boardGroupId > 0) { if (!MembershipContext.AuthenticatedUser.IsGroupAdministrator(boardGroupId)) { usUsers.Enabled = false; return; } } else if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.MessageBoards", "Modify")) { usUsers.Enabled = false; return; } } } // Check forum permission if (ForumID > 0) { if (GroupID > 0) { if (!MembershipContext.AuthenticatedUser.IsGroupAdministrator(GroupID)) { usUsers.Enabled = false; return; } } else if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("cms.forums", CMSAdminControl.PERMISSION_MODIFY)) { usUsers.Enabled = false; return; } } }