protected void Page_Load(object sender, EventArgs e)
    {
        CurrentUserInfo user = CMSContext.CurrentUser;

        // Check UI profile for membership
        if (!user.IsAuthorizedPerUIElement("CMS.Administration", "Membership"))
        {
            RedirectToCMSDeskUIElementAccessDenied("CMS.Administration", "Membership");
        }

        // Check "read" permission
        if (!user.IsAuthorizedPerResource("CMS.Membership", "Read"))
        {
            RedirectToAccessDenied("CMS.Membership", "Read");
        }

        DataSet ds = MembershipRoleInfoProvider.GetMembershipRoles("RoleID = " + RoleID, String.Empty);

        if (!DataHelper.DataSourceIsEmpty(ds))
        {
            currentValues = TextHelper.Join(";", SqlHelperClass.GetStringValues(ds.Tables[0], "MembershipID"));
        }

        if (!RequestHelper.IsPostBack())
        {
            // Set values
            usMemberships.Value = currentValues;
        }

        // Init uni selector
        usMemberships.ReturnColumnName    = "MembershipID";
        usMemberships.DynamicColumnName   = true;
        usMemberships.OnSelectionChanged += new EventHandler(usMemberships_OnSelectionChanged);

        if (!String.IsNullOrEmpty(currentValues))
        {
            usMemberships.WhereCondition = "MembershipID NOT IN (" + currentValues.Replace(';', ',') + ")";
        }

        string siteWhere = (SiteID <= 0) ? "MembershipSiteID IS NULL" : "MembershipSiteID =" + SiteID;

        usMemberships.ListingWhereCondition = SqlHelperClass.AddWhereCondition(usMemberships.ListingWhereCondition, siteWhere);
        usMemberships.WhereCondition        = SqlHelperClass.AddWhereCondition(usMemberships.WhereCondition, siteWhere);
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int siteID = CMSContext.CurrentSiteID;

        membershipID = QueryHelper.GetInteger("MembershipID", 0);

        // Test security
        MembershipInfo mi = MembershipInfoProvider.GetMembershipInfo(membershipID);

        EditedObject = mi;

        CheckMembershipPermissions(mi);

        // Set SiteID
        if (mi != null)
        {
            siteID = mi.MembershipSiteID;
        }

        usRoles.OnSelectionChanged += new EventHandler(usRoles_OnSelectionChanged);

        string where           = (siteID == 0) ? "SiteID IS NULL" : "SiteID = " + siteID;
        usRoles.WhereCondition = where + " AND RoleGroupID IS NULL";

        DataSet ds = MembershipRoleInfoProvider.GetMembershipRoles("MembershipID = " + membershipID, String.Empty);

        if (!DataHelper.DataSourceIsEmpty(ds))
        {
            currentValues = TextHelper.Join(";", SystemDataHelper.GetStringValues(ds.Tables[0], "RoleID"));
        }

        if (!RequestHelper.IsPostBack())
        {
            // Set values
            usRoles.Value = currentValues;
        }
    }