当前位置: 首页>>代码示例>>C#>>正文


C# RoleController.GetPortalRoles方法代码示例

本文整理汇总了C#中DotNetNuke.Security.Roles.RoleController.GetPortalRoles方法的典型用法代码示例。如果您正苦于以下问题:C# RoleController.GetPortalRoles方法的具体用法?C# RoleController.GetPortalRoles怎么用?C# RoleController.GetPortalRoles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DotNetNuke.Security.Roles.RoleController的用法示例。


在下文中一共展示了RoleController.GetPortalRoles方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetGroups

        public override ArrayList GetGroups()
        {
            //Dim adsiConfig As Authentication.ADSI.Configuration = Authentication.ADSI.Configuration.GetConfig(_portalSettings.PortalId)
            // Normally number of roles in DNN less than groups in Authentication,
            // so start from DNN roles to get better performance
            try
            {
                // Obtain search object
                //Dim rootDomain As DirectoryEntry = GetRootDomain()
                //Dim objSearch As New ADSI.Search(rootDomain)

                ArrayList colGroup = new ArrayList();
                RoleController objRoleController = new RoleController();
                ArrayList lstRoles = objRoleController.GetPortalRoles( _portalSettings.PortalId );
                RoleInfo objRole;

                foreach( RoleInfo tempLoopVar_objRole in lstRoles )
                {
                    objRole = tempLoopVar_objRole;
                    // Auto assignment roles have been added by DNN, so don't need to get them
                    if( ! objRole.AutoAssignment )
                    {
                        // It's possible in multiple domains network that search result return more than one group with the same name (i.e Administrators)
                        // We better check them all
                        DirectoryEntry entry;
                        foreach( DirectoryEntry tempLoopVar_entry in Utilities.GetGroupEntriesByName( objRole.RoleName ) )
                        {
                            entry = tempLoopVar_entry;
                            GroupInfo group = new GroupInfo();

                            group.PortalID = objRole.PortalID;
                            group.RoleID = objRole.RoleID;
                            group.GUID = entry.NativeGuid;
                            group.Location = Utilities.GetEntryLocation( entry );
                            group.RoleName = objRole.RoleName;
                            group.Description = objRole.Description;
                            group.ServiceFee = objRole.ServiceFee;
                            group.BillingFrequency = objRole.BillingFrequency;
                            group.TrialPeriod = objRole.TrialPeriod;
                            group.TrialFrequency = objRole.TrialFrequency;
                            group.BillingPeriod = objRole.BillingPeriod;
                            group.TrialFee = objRole.TrialFee;
                            group.IsPublic = objRole.IsPublic;
                            group.AutoAssignment = objRole.AutoAssignment;
                            // Populate member with distingushed name
                            PopulateMembership( group, entry );

                            colGroup.Add( group );
                        }
                    }
                }

                return colGroup;
            }
            catch( COMException exc )
            {
                Exceptions.LogException( exc );
                return null;
            }
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:60,代码来源:ADSIProvider.cs

示例2: ShowSettings

        protected void ShowSettings()
        {
            //get the tracking ID
            if (ModuleSettings.ContainsKey("GoogleTrackingId"))
                txtAnalyticsTrackingId.Text = (string)ModuleSettings["GoogleTrackingId"];

            if (ModuleSettings.ContainsKey("LocalHostAddress"))
            {
                txtLocalHostName.Text = (string)ModuleSettings["LocalHostAddress"];
            }
            
            //populate the drop down box
            RoleController rc = new DotNetNuke.Security.Roles.RoleController();
            ArrayList roles = rc.GetPortalRoles(this.PortalId);
            //put in a dummy role to allow no restriction on role
            RoleInfo dummyRole = new RoleInfo();
            dummyRole.RoleID = -1;
            dummyRole.RoleName = "[Do Not Hide Tracking]";
            roles.Insert(0, dummyRole);
            ddlSecurityGroups.DataSource = roles;
            ddlSecurityGroups.DataValueField = "RoleID";
            ddlSecurityGroups.DataTextField = "RoleName";
            ddlSecurityGroups.DataBind();

            //get the security group
            if (ModuleSettings.ContainsKey("HideTrackingFromRole"))
            {
                foreach(ListItem item in ddlSecurityGroups.Items)
                {
                    string value = (string)ModuleSettings["HideTrackingFromRole"];
                    if (item.Text == value)
                        ddlSecurityGroups.SelectedValue = item.Value;
                }
            }
        }
开发者ID:goedings,项目名称:VendorLink,代码行数:35,代码来源:ScripterSettings.ascx.cs

示例3: BindData

        /// <summary>
        /// BindData gets the roles from the Database and binds them to the DataGrid
        /// </summary>
        /// <history>
        /// 	[cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        ///     [cnurse]    01/05/2006  Updated to reflect Use of Role Groups
        /// </history>
        private void BindData()
        {
            // Get the portal's roles from the database
            RoleController objRoles = new RoleController();
            ArrayList arrRoles;

            if( RoleGroupId < - 1 )
            {
                arrRoles = objRoles.GetPortalRoles( PortalId );
            }
            else
            {
                arrRoles = objRoles.GetRolesByGroup( PortalId, RoleGroupId );
            }
            grdRoles.DataSource = arrRoles;

            if( RoleGroupId < 0 )
            {
                lnkEditGroup.Visible = false;
                cmdDelete.Visible = false;
            }
            else
            {
                lnkEditGroup.Visible = true;
                lnkEditGroup.NavigateUrl = EditUrl( "RoleGroupId", RoleGroupId.ToString(), "EditGroup" );
                cmdDelete.Visible = !( arrRoles.Count > 0 );
                ClientAPI.AddButtonConfirm( cmdDelete, Localization.GetString( "DeleteItem" ) );
            }

            Localization.LocalizeDataGrid( ref grdRoles, this.LocalResourceFile );

            grdRoles.DataBind();
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:41,代码来源:Roles.ascx.cs

示例4: Page_Load

        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// 	[cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void Page_Load( Object sender, EventArgs e )
        {
            try
            {
                if( ! Page.IsPostBack )
                {
                    RoleController objRoleController = new RoleController();
                    chkRoles.DataSource = objRoleController.GetPortalRoles( PortalId );
                    chkRoles.DataBind();

                    //Dim FileList As ArrayList = GetFileList(PortalId)
                    //cboAttachment.DataSource = FileList
                    //cboAttachment.DataBind()
                    //cmdUpload.NavigateUrl =Common.Globals.NavigateURL("File Manager")

                    txtFrom.Text = UserInfo.Email;
                }
            }
            catch( Exception exc ) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException( this, exc );
            }
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:32,代码来源:BulkEmail.ascx.cs

示例5: GetRoles

        /// <summary>
        /// Gets the roles from the Database and loads them into the Roles property
        /// </summary>
        private void GetRoles()
        {
            RoleController objRoleController = new RoleController();
            int RoleGroupId = -2;
            if( ( cboRoleGroups != null ) && ( cboRoleGroups.SelectedValue != null ) )
            {
                RoleGroupId = int.Parse( cboRoleGroups.SelectedValue );
            }

            if( RoleGroupId > -2 )
            {
                _roles = objRoleController.GetRolesByGroup( PortalController.GetCurrentPortalSettings().PortalId, RoleGroupId );
            }
            else
            {
                _roles = objRoleController.GetPortalRoles( PortalController.GetCurrentPortalSettings().PortalId );
            }

            if( RoleGroupId < 0 )
            {
                RoleInfo r = new RoleInfo();
                r.RoleID = int.Parse( Globals.glbRoleUnauthUser );
                r.RoleName = Globals.glbRoleUnauthUserName;
                _roles.Add( r );
                r = new RoleInfo();
                r.RoleID = int.Parse( Globals.glbRoleAllUsers );
                r.RoleName = Globals.glbRoleAllUsersName;
                _roles.Add( r );
            }
            _roles.Reverse();
            _roles.Sort( new RoleComparer() );
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:35,代码来源:PermissionsGrid.cs

示例6: BindData

        private void BindData()
        {
            if (!TokenReplacer.IsMyTokensInstalled()) {
                lblMyTokensRefUrl.InnerHtml = lblMyTokensParamVal.InnerHtml = lblMyTokensParam.InnerHtml = lblMyTokensRef.InnerHtml = lblMyTokens.InnerHtml = "can contain MyTokens (get it <a href = 'http://www.avatar-soft.ro/Products/MyTokens/tabid/148/Default.aspx'>here</a>)";
            } else {
                lblMyTokensRefUrl.InnerHtml = lblMyTokensParam.InnerHtml = lblMyTokensRef.InnerHtml = lblMyTokens.InnerHtml = "can contain MyTokens (installed)";
                lblMyTokensParamVal.InnerHtml = lblMyTokens.InnerHtml = "both parameter name and value can contain MyTokens (installed)";
            }

            // clear form
            txtUrl.Text = "";
            txtUrlRef.Text = "";
            cbKeepOnPage.Checked = false;
            cbKeepOnPageRef.Checked = false;
            cbByRoleLogout.Checked = false;
            reqUrl.IsValid = true;

            tbReferrer.Text = "";
            txtUrlRef.Text = "";
            reqUrlRef.IsValid = true;
            cbUrlRefMathDomain.Checked = false;
            cbKeepOnPageRef.Checked = false;

            cbParamRed_Logout.Checked = false;
            cbParamRed_KeepOnPage.Checked = false;
            tbParamRed_Url.Text = "";
            tbParamRed_Name.Text = "";
            tbParamRed_Value.Text = "";
            reqUrlParam.IsValid = true;
            ddParamOp.ClearSelection();
            ddParamOp.SelectedIndex = 0;
            ddParamType.ClearSelection();
            ddParamType.SelectedIndex = 0;

            // bind settings
            ModuleController modCtrl = new ModuleController();
            try {
                txtGetParam.Text = modCtrl.GetModuleSettings(ModuleId)["GetParam"].ToString();
            } catch {
                txtGetParam.Text = "";
            }
            try {
                txtGetParamRefferer.Text = modCtrl.GetModuleSettings(ModuleId)["GetParamRef"].ToString();
            } catch {
                txtGetParamRefferer.Text = "";
            }
            try {
                txtDefaultUrl.Text = modCtrl.GetModuleSettings(ModuleId)["DefaultUrl"].ToString();
            } catch {
                txtDefaultUrl.Text = "";
            }
            try {
                cbLogout.Checked = Convert.ToBoolean(modCtrl.GetModuleSettings(ModuleId)["LogoutUser"].ToString());
            } catch {
                cbLogout.Checked = false;
            }

            // bind roles DD
            ddRoles.ClearSelection();
            ddRoles.Items.Clear();

            RoleController roleCtrl = new RoleController();
            ArrayList roles = roleCtrl.GetPortalRoles(PortalId);

            // remove admin role
            foreach (RoleInfo rInfo in roles) {
                if (rInfo.RoleID == PortalSettings.AdministratorRoleId) {
                    roles.Remove(rInfo);
                    break;
                }
            }

            // now, add All Users and Unregistered Users
            roles.Insert(0, new RoleInfo() { RoleID = 0, RoleName = "Unregistered Users" });
            roles.Insert(0, new RoleInfo() { RoleID = -1, RoleName = "All Users" });

            ddRoles.DataTextField = "RoleName";
            ddRoles.DataValueField = "RoleID";
            ddRoles.DataSource = roles;
            ddRoles.DataBind();

            // bind redirects table
            GetDbConfig();
            sqlDataSource.SelectCommand = _databaseOwner + _objectQualifier + "avtRedirect_GetRedirects";
            sqlDataSource.SelectParameters.Clear();
            sqlDataSource.SelectParameters.Add(new Parameter() { Name = "portalId", DefaultValue = PortalId.ToString() });
            sqlDataSource.SelectParameters.Add(new Parameter() { Name = "moduleId", DefaultValue = ModuleId.ToString() });
            sqlDataSource.DataBind();
            vwRedirects.DataBind();

            // bind redirects ref table
            sqlDataSourceRef.SelectCommand = _databaseOwner + _objectQualifier + "avtRedirect_GetRedirectsRef";
            sqlDataSourceRef.SelectParameters.Clear();
            sqlDataSourceRef.SelectParameters.Add(new Parameter() { Name = "moduleId", DefaultValue = ModuleId.ToString() });
            sqlDataSourceRef.DataBind();
            vwRedirectsRef.DataBind();

            // bind redirects param table
            sqlDataSourceParam.SelectCommand = _databaseOwner + _objectQualifier + "avtRedirect_GetRedirectsParam";
            sqlDataSourceParam.SelectParameters.Clear();
//.........这里部分代码省略.........
开发者ID:bogdan-litescu,项目名称:DnnRedirect,代码行数:101,代码来源:Manage.ascx.cs

示例7: cmdRSVP_Click

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// cmdRSVP_Click runs when the Subscribe to RSVP Code Roles Button is clicked
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// 	[cnurse]	01/19/2006  created
        /// </history>
        /// -----------------------------------------------------------------------------
        private void cmdRSVP_Click(object sender, EventArgs e)
        {
            //Get the RSVP code
            string code = txtRSVPCode.Text;
            bool rsvpCodeExists = false;
            if (!String.IsNullOrEmpty(code))
            {
                //Get the roles from the Database
                var objRoles = new RoleController();
                ArrayList arrRoles = objRoles.GetPortalRoles(PortalSettings.PortalId);

                //Parse the roles
                foreach (RoleInfo objRole in arrRoles)
                {
                    if (objRole.RSVPCode == code)
                    {
                        objRoles.UpdateUserRole(PortalId, UserInfo.UserID, objRole.RoleID);
                        rsvpCodeExists = true;

                        //Raise SubscriptionUpdated Event
                        OnSubscriptionUpdated(new SubscriptionUpdatedEventArgs(false, objRole.RoleName));
                    }
                }
                if (rsvpCodeExists)
                {
                    lblRSVP.Text = Localization.GetString("RSVPSuccess", LocalResourceFile);
                    //Reset RSVP Code field
                    txtRSVPCode.Text = "";
                }
                else
                {
                    lblRSVP.Text = Localization.GetString("RSVPFailure", LocalResourceFile);
                }
            }
            DataBind();
        }
开发者ID:rickfox,项目名称:Steves,代码行数:46,代码来源:MemberServices.ascx.cs

示例8: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                jQuery.RequestDnnPluginsRegistration();

                //Store the item id on every load
                if (Request.QueryString["EntryId"] != null)
                {
                    itemId = Int32.Parse(Request.QueryString["EntryId"]);
                }

                if (!IsPostBack)
                {
                    //Load the list of roles
                    var roleController = new RoleController();
                    ddlRequiredRole.DataSource = roleController.GetPortalRoles(PortalId);
                    ddlRequiredRole.DataTextField = "RoleName";
                    ddlRequiredRole.DataValueField = "RoleName";
                    ddlRequiredRole.DataBind();
                    ddlRequiredRole.Items.Insert(0,
                                                 new ListItem(
                                                     Localization.GetString("SameAsModule", LocalResourceFile),
                                                     "-1"));

                    //check we have an item to lookup
                    if (!Null.IsNull(itemId))
                    {
                        //load the item
                        var controller = new ExpandableTextHtmlController();
                        var item = controller.GetExpandableTextHtml(ModuleId, itemId);

                        //ensure we have an item
                        if (item != null)
                        {
                            txtTitle.Text = item.Title;
                            txtBody.Text = item.Body;
                            chkIsExpanded.Checked = item.IsExpanded;
                            txtSortOrder.Text = item.SortOrder.ToString();
                            litContentId.Text = string.Format("ICG_ETH_{0}", item.ItemId.ToString());
                            txtPublishDate.Text = item.PublishDate.ToShortDateString();
                            var foundItem = ddlRequiredRole.Items.FindByValue(item.RequiredRole);
                            if (foundItem != null)
                                ddlRequiredRole.SelectedValue = item.RequiredRole;
                        }
                        else
                            Response.Redirect(Globals.NavigateURL(), true);
                    }
                    else
                    {
                        cmdDelete.Visible = false;

                        //Default sort order to 0
                        txtSortOrder.Text = "0";
                    }
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
开发者ID:IowaComputerGurus,项目名称:DNN-ExpandableText,代码行数:62,代码来源:EditExpandableTextHtml.ascx.cs

示例9: SetCurrentUser

        /// <summary>
        ///   Sets the current user so that checking authentication and roles works.
        /// </summary>
        /// <remarks>
        ///   Copies functionality from <c>DotNetNuke.HttpModules.Membership.MembershipModule.OnAuthenticateRequest</c>
        ///   to get the current user set as the "Current User"
        /// </remarks>
        private void SetCurrentUser()
        {
            // Obtain PortalSettings from Current Context
            var portalSettings = PortalController.GetCurrentPortalSettings();

            if (this.Context.Request.IsAuthenticated && portalSettings != null)
            {
                var roleController = new RoleController();
                var cachedUser = UserController.GetCachedUser(portalSettings.PortalId, this.Context.User.Identity.Name);

                if (this.Context.Request.Cookies["portalaliasid"] != null)
                {
            // ReSharper disable PossibleNullReferenceException
                    var portalCookie = FormsAuthentication.Decrypt(this.Context.Request.Cookies["portalaliasid"].Value);

                    // check if user has switched portals
                    if (portalSettings.PortalAlias.PortalAliasID != int.Parse(portalCookie.UserData))
                    {
                        // expire cookies if portal has changed
                        this.Context.Response.Cookies["portalaliasid"].Value = null;
                        this.Context.Response.Cookies["portalaliasid"].Path = "/";
                        this.Context.Response.Cookies["portalaliasid"].Expires = DateTime.Now.AddYears(-30);

                        this.Context.Response.Cookies["portalroles"].Value = null;
                        this.Context.Response.Cookies["portalroles"].Path = "/";
                        this.Context.Response.Cookies["portalroles"].Expires = DateTime.Now.AddYears(-30);

            // ReSharper restore PossibleNullReferenceException
                    }
                }

                // authenticate user and set last login ( this is necessary for users who have a permanent Auth cookie set )
                if (cachedUser == null || cachedUser.IsDeleted || cachedUser.Membership.LockedOut ||
                    cachedUser.Membership.Approved == false ||
                    cachedUser.Username.ToLower() != this.Context.User.Identity.Name.ToLower())
                {
                    var portalSecurity = new PortalSecurity();
                    portalSecurity.SignOut();

                    // Remove user from cache
                    if (cachedUser != null)
                    {
                        DataCache.ClearUserCache(portalSettings.PortalId, this.Context.User.Identity.Name);
                    }

                    // Redirect browser back to home page
                    this.Context.Response.Redirect(this.Context.Request.RawUrl, true);
                    return;
                }

                // valid Auth cookie
                // if users LastActivityDate is outside of the UsersOnlineTimeWindow then record user activity
                if (
                    DateTime.Compare(
                        cachedUser.Membership.LastActivityDate.AddMinutes(Host.UsersOnlineTimeWindow), DateTime.Now) < 0)
                {
                    // update LastActivityDate and IP Address for user
                    cachedUser.Membership.LastActivityDate = DateTime.Now;
                    cachedUser.LastIPAddress = this.Context.Request.UserHostAddress;
                    UserController.UpdateUser(portalSettings.PortalId, cachedUser);
                }

                // refreshroles is set when a role is added to a user by an administrator
                bool refreshCookies = cachedUser.RefreshRoles;

                // check for RSVP code
                if (!cachedUser.RefreshRoles && this.Context.Request.QueryString["rsvp"] != null &&
                    string.IsNullOrEmpty(this.Context.Request.QueryString["rsvp"]) == false)
                {
                    foreach (RoleInfo objRole in roleController.GetPortalRoles(portalSettings.PortalId))
                    {
                        if (objRole.RSVPCode == this.Context.Request.QueryString["rsvp"])
                        {
                            roleController.UpdateUserRole(portalSettings.PortalId, cachedUser.UserID, objRole.RoleID);

                            // clear portalroles so the new role is added to the cookie below
                            refreshCookies = true;
                        }
                    }
                }

                // create cookies if they do not exist yet for this session.
                if (this.Context.Request.Cookies["portalroles"] == null || refreshCookies)
                {
                    // keep cookies in sync
                    var currentDateTime = DateTime.Now;

                    // create a cookie authentication ticket ( version, user name, issue time, expires every hour, don't persist cookie, roles )
                    var portalTicket = new FormsAuthenticationTicket(
                        1,
                        this.Context.User.Identity.Name,
                        currentDateTime,
                        currentDateTime.AddHours(1),
//.........这里部分代码省略.........
开发者ID:krishna23456,项目名称:Engage-Survey,代码行数:101,代码来源:ClientService.asmx.cs

示例10: CreateUser

        /// <summary>
        /// Creates a new User in the Data Store
        /// </summary>
        /// <remarks></remarks>
        /// <param name="objUser">The userInfo object to persist to the Database</param>
        /// <returns>The Created status ot the User</returns>
        public static UserCreateStatus CreateUser(ref UserInfo objUser)
        {
            //Create the User
            UserCreateStatus createStatus = memberProvider.CreateUser(ref objUser);

            if (createStatus == UserCreateStatus.Success && !objUser.IsSuperUser)
            {
                RoleController objRoles = new RoleController();

                // autoassign user to portal roles
                ArrayList arrRoles = objRoles.GetPortalRoles(objUser.PortalID);
                
                for (int i = 0; i < arrRoles.Count; i++)
                {
                    RoleInfo objRole = (RoleInfo)arrRoles[i];
                    if (objRole.AutoAssignment)
                    {
                        objRoles.AddUserRole(objUser.PortalID, objUser.UserID, objRole.RoleID, Null.NullDate, Null.NullDate);
                    }
                }
            }

            return createStatus;
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:30,代码来源:UserController.cs

示例11: BindData

        /// <summary>
        /// BindData loads the settings from the Database
        /// </summary>
        /// <history>
        /// 	[cnurse]	10/18/2004	documented
        /// </history>
        private void BindData()
        {
            // declare roles
            ArrayList arrAvailableAuthViewRoles = new ArrayList();
            ArrayList arrAvailableAuthEditRoles = new ArrayList();

            // add an entry of All Users for the View roles
            arrAvailableAuthViewRoles.Add( new ListItem( "All Users", Globals.glbRoleAllUsers ) );
            // add an entry of Unauthenticated Users for the View roles
            arrAvailableAuthViewRoles.Add( new ListItem( "Unauthenticated Users", Globals.glbRoleUnauthUser ) );
            // add an entry of All Users for the Edit roles
            arrAvailableAuthEditRoles.Add( new ListItem( "All Users", Globals.glbRoleAllUsers ) );

            // process portal roles
            RoleController objRoles = new RoleController();
            RoleInfo objRole;
            ArrayList arrRoleInfo = objRoles.GetPortalRoles( PortalId );
            foreach( RoleInfo tempLoopVar_objRole in arrRoleInfo )
            {
                objRole = tempLoopVar_objRole;
                arrAvailableAuthViewRoles.Add( new ListItem( objRole.RoleName, objRole.RoleID.ToString() ) );
            }
            foreach( RoleInfo tempLoopVar_objRole in arrRoleInfo )
            {
                objRole = tempLoopVar_objRole;
                arrAvailableAuthEditRoles.Add( new ListItem( objRole.RoleName, objRole.RoleID.ToString() ) );
            }

            // get module
            ModuleController objModules = new ModuleController();
            ModuleInfo objModule = objModules.GetModule( moduleId, TabId, false );
            if( objModule != null )
            {
                // configure grid
                DesktopModuleController objDeskMod = new DesktopModuleController();
                DesktopModuleInfo desktopModule = objDeskMod.GetDesktopModule( objModule.DesktopModuleID );
                dgPermissions.ResourceFile = Globals.ApplicationPath + "/DesktopModules/" + desktopModule.FolderName + "/" + Localization.LocalResourceDirectory + "/" + Localization.LocalSharedResourceFile;

                chkInheritPermissions.Checked = objModule.InheritViewPermissions;
                dgPermissions.InheritViewPermissionsFromTab = objModule.InheritViewPermissions;

                txtTitle.Text = objModule.ModuleTitle;
                ctlIcon.Url = objModule.IconFile;

                if( cboTab.Items.FindByValue( objModule.TabID.ToString() ) != null )
                {
                    cboTab.Items.FindByValue( objModule.TabID.ToString() ).Selected = true;
                }

                chkAllTabs.Checked = objModule.AllTabs;
                cboVisibility.SelectedIndex = (int)objModule.Visibility;

                ModuleDefinitionController objModuleDefController = new ModuleDefinitionController();
                ModuleDefinitionInfo objModuleDef = objModuleDefController.GetModuleDefinition( objModule.ModuleDefID );
                if( objModuleDef.DefaultCacheTime == Null.NullInteger )
                {
                    rowCache.Visible = false;
                }
                else
                {
                    txtCacheTime.Text = objModule.CacheTime.ToString();
                }

                txtCacheTime.Text = objModule.CacheTime.ToString();

                // populate view roles
                ArrayList arrAssignedAuthViewRoles = new ArrayList();
                Array arrAuthViewRoles = objModule.AuthorizedViewRoles.Split(new char[] { ';' });
                foreach( string strRole in arrAuthViewRoles )
                {
                    if( !String.IsNullOrEmpty( strRole ) )
                    {
                        foreach( ListItem objListItem in arrAvailableAuthViewRoles )
                        {                            
                            if( objListItem.Value == strRole )
                            {
                                arrAssignedAuthViewRoles.Add( objListItem );
                                arrAvailableAuthViewRoles.Remove( objListItem );
                                break;
                            }
                        }
                    }
                }

                // populate edit roles
                ArrayList arrAssignedAuthEditRoles = new ArrayList();
                Array arrAuthEditRoles = objModule.AuthorizedEditRoles.Split(new char[] { ';' });
                foreach( string strRole in arrAuthEditRoles )
                {
                    
                    if( !String.IsNullOrEmpty( strRole ) )
                    {
                        foreach( ListItem objListItem in arrAvailableAuthEditRoles )
                        {                            
//.........这里部分代码省略.........
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:101,代码来源:ModuleSettings.ascx.cs

示例12: Roles_List

        public HttpResponseMessage Roles_List()
        {

            int v_Current_Portal_ID = this.ActiveModule.PortalID;

            List<Entities.Role_Info> v_Return_List = new List<Entities.Role_Info>();

            DotNetNuke.Security.Roles.RoleController v_Roles_Controller = new DotNetNuke.Security.Roles.RoleController();
            ArrayList v_Roles_List = v_Roles_Controller.GetPortalRoles(v_Current_Portal_ID);

            foreach (DotNetNuke.Security.Roles.RoleInfo v_Roles_Info in v_Roles_List)
            {

                Entities.Role_Info v_Role_Info_Json = new Entities.Role_Info();
                v_Role_Info_Json.RoleName = v_Roles_Info.RoleName;
                v_Role_Info_Json.ID = v_Roles_Info.RoleID;
                v_Return_List.Add(v_Role_Info_Json);

            }

            string v_json_resulted = Newtonsoft.Json.JsonConvert.SerializeObject(v_Return_List);

            return Request.CreateResponse(HttpStatusCode.OK, v_json_resulted);

        }
开发者ID:joinsaturn,项目名称:UManage,代码行数:25,代码来源:WebApiController.cs

示例13: BindData

        /// <summary>
        /// BindData loads the controls from the Database
        /// </summary>
        /// <history>
        /// 	[cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        private void BindData()
        {
            RoleController objRoles = new RoleController();

            // bind all portal roles to dropdownlist
            if( _roleId == - 1 )
            {
                if( cboRoles.Items.Count == 0 )
                {
                    cboRoles.DataSource = objRoles.GetPortalRoles( PortalId );
                    cboRoles.DataBind();
                }
            }
            else
            {
                if( ! Page.IsPostBack )
                {
                    RoleInfo objRole = objRoles.GetRole( _roleId, PortalId );
                    if( objRole != null )
                    {
                        cboRoles.Items.Add( new ListItem( objRole.RoleName, objRole.RoleID.ToString() ) );
                        cboRoles.Items[0].Selected = true;
                        lblTitle.Text = string.Format( Localization.GetString( "RoleTitle.Text", LocalResourceFile ), objRole.RoleName, objRole.RoleID );
                    }
                    cmdAdd.Text = string.Format( Localization.GetString( "AddUser.Text", LocalResourceFile ), objRole.RoleName );
                    cboRoles.Visible = false;
                    plRoles.Visible = false;
                }
            }

            // bind all portal users to dropdownlist
            if( _userId == - 1 )
            {
                if( UsersControl == UsersControl.Combo )
                {
                    if( cboUsers.Items.Count == 0 )
                    {
                        cboUsers.DataSource = UserController.GetUsers( PortalId, false );
                        cboUsers.DataBind();
                    }
                    txtUsers.Visible = false;
                    cboUsers.Visible = true;
                    cmdValidate.Visible = false;
                }
                else
                {
                    txtUsers.Visible = true;
                    cboUsers.Visible = false;
                    cmdValidate.Visible = true;
                }
            }
            else
            {
                UserInfo objUser = UserController.GetUser( PortalId, _userId, false );
                if( objUser != null )
                {
                    txtUsers.Text = objUser.UserID.ToString();
                    lblTitle.Text = string.Format( Localization.GetString( "UserTitle.Text", LocalResourceFile ), objUser.Username, objUser.UserID );
                }
                cmdAdd.Text = string.Format( Localization.GetString( "AddRole.Text", LocalResourceFile ), objUser.Profile.FullName );
                txtUsers.Visible = false;
                cboUsers.Visible = false;
                cmdValidate.Visible = false;
                plUsers.Visible = false;
            }
            
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:74,代码来源:SecurityRoles.ascx.cs

示例14: BindData

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// BindData loads the controls from the Database
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// 	[cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        /// -----------------------------------------------------------------------------
        private void BindData()
        {
            var objRoles = new RoleController();

            //bind all portal roles to dropdownlist
            if (RoleId == Null.NullInteger)
            {
                if (cboRoles.Items.Count == 0)
                {
                    ArrayList arrRoles = objRoles.GetPortalRoles(PortalId);

                    //Remove access to Admin Role if use is not a member of the role
                    int roleIndex = Null.NullInteger;
                    foreach (RoleInfo tmpRole in arrRoles)
                    {
                        if (tmpRole.RoleName == PortalSettings.AdministratorRoleName)
                        {
                            if (!PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName))
                            {
                                roleIndex = arrRoles.IndexOf(tmpRole);
                            }
                        }
                        break;
                    }
                    if (roleIndex > Null.NullInteger)
                    {
                        arrRoles.RemoveAt(roleIndex);
                    }
                    cboRoles.DataSource = arrRoles;
                    cboRoles.DataBind();
                }
            }
            else
            {
                if (!Page.IsPostBack)
                {
                    if (Role != null)
                    {
                        cboRoles.Items.Add(new ListItem(Role.RoleName, Role.RoleID.ToString()));
                        cboRoles.Items[0].Selected = true;
                        lblTitle.Text = string.Format(Localization.GetString("RoleTitle.Text", LocalResourceFile), Role.RoleName, Role.RoleID);
                    }
                    cboRoles.Visible = false;
                    plRoles.Visible = false;
                }
            }

            //bind all portal users to dropdownlist
            if (UserId == -1)
            {
                //Make sure user has enough permissions
                if (Role.RoleName == PortalSettings.AdministratorRoleName && !PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName))
                {
                    UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("NotAuthorized", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning);
                    pnlRoles.Visible = false;
                    pnlUserRoles.Visible = false;
                    chkNotify.Visible = false;
                    return;
                }
                if (UsersControl == UsersControl.Combo)
                {
                    if (cboUsers.Items.Count == 0)
                    {
                        foreach (UserInfo objUser in UserController.GetUsers(PortalId))
                        {
                            cboUsers.Items.Add(new ListItem(objUser.DisplayName + " (" + objUser.Username + ")", objUser.UserID.ToString()));
                        }
                    }
                    txtUsers.Visible = false;
                    cboUsers.Visible = true;
                    cmdValidate.Visible = false;
                }
                else
                {
                    txtUsers.Visible = true;
                    cboUsers.Visible = false;
                    cmdValidate.Visible = true;
                }
            }
            else
            {
                if (User != null)
                {
                    txtUsers.Text = User.UserID.ToString();
                    lblTitle.Text = string.Format(Localization.GetString("UserTitle.Text", LocalResourceFile), User.Username, User.UserID);
                }
                txtUsers.Visible = false;
                cboUsers.Visible = false;
                cmdValidate.Visible = false;
//.........这里部分代码省略.........
开发者ID:patonomatic,项目名称:VUWTC,代码行数:101,代码来源:SecurityRoles.ascx.cs

示例15: TransferUsersToMembershipProvider

        /// <summary>
        /// TransferUsersToMembershipProvider transfers legacy users to the
        ///	new ASP.NET MemberRole Architecture
        /// </summary>
        /// <history>
        /// 	[cnurse]	11/6/2004	documented
        ///     [cnurse]    12/15/2005  Moved to MembershipProvider
        /// </history>
        public override void TransferUsersToMembershipProvider()
        {
            int j;
            ArrayList arrUsers = new ArrayList();
            UserController objUserController = new UserController();

            //Get the Super Users and Transfer them to the Provider
            arrUsers = GetLegacyUsers( dataProvider.GetSuperUsers() );
            TransferUsers( - 1, arrUsers, true );

            PortalController objPortalController = new PortalController();
            ArrayList arrPortals;
            arrPortals = objPortalController.GetPortals();

            for( j = 0; j <= arrPortals.Count - 1; j++ )
            {
                PortalInfo objPortal;
                objPortal = (PortalInfo)arrPortals[j];

                RoleController objRoles = new RoleController();
                ArrayList arrRoles = objRoles.GetPortalRoles( objPortal.PortalID );
                int q;
                for( q = 0; q <= arrRoles.Count - 1; q++ )
                {
                    try
                    {
                        System.Web.Security.Roles.CreateRole( ( (RoleInfo)arrRoles[q] ).RoleName );
                    }
                    catch( Exception exc )
                    {
                        Exceptions.LogException( exc );
                    }
                }

                //Get the Portal Users and Transfer them to the Provider
                arrUsers = GetLegacyUsers( dataProvider.GetUsers( objPortal.PortalID ) );
                TransferUsers( objPortal.PortalID, arrUsers, false );
            }
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:47,代码来源:AspNetMembershipProvider.cs


注:本文中的DotNetNuke.Security.Roles.RoleController.GetPortalRoles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。