예제 #1
0
        //*******************************************************
        //
        // The BindData helper method is used to bind the list of
        // security roles for this portal to an asp:datalist server control
        //
        //*******************************************************

        private void BindData()
        {
            // unhide the Windows Authentication UI, if application
            if (User.Identity.AuthenticationType != "Forms")
            {
                windowsUserName.Visible = true;
                addNew.Visible          = true;
            }

            // add the role name to the title
            if (roleName != "")
            {
                title.InnerText = "Role Membership: " + roleName;
            }

            // Get the portal's roles from the database
            AdminDB admin = new AdminDB();

            // bind users in role to DataList
            usersInRole.DataSource = admin.GetRoleMembers(roleId);
            usersInRole.DataBind();

            // bind all portal users to dropdownlist
            allUsers.DataSource = admin.GetUsers();
            allUsers.DataBind();
        }
        //*******************************************************
        //
        // The BindData helper method is used to bind the list of
        // users for this portal to an asp:DropDownList server control
        //
        //*******************************************************

        private void BindData()
        {
            // change the message between Windows and Forms authentication
            if (Context.User.Identity.AuthenticationType != "Forms")
            {
                Message.Text = "Users must be registered to view secure content.  Users may add themselves using the Register form, and Administrators may add users to specific roles using the Security Roles function above.  This section permits Administrators to manage users and their security roles directly.";
            }
            else
            {
                Message.Text = "Domain users do not need to be registered to access portal content that is available to \"All Users\".  Administrators may add domain users to specific roles using the Security Roles function above.  This section permits Administrators to manage users and their security roles directly.";
            }

            // Get the list of registered users from the database
            AdminDB admin = new AdminDB();

            // bind all portal users to dropdownlist
            allUsers.DataSource = admin.GetUsers();
            allUsers.DataBind();
        }