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


C# Roles.RoleInfo类代码示例

本文整理汇总了C#中DotNetNuke.Security.Roles.RoleInfo的典型用法代码示例。如果您正苦于以下问题:C# RoleInfo类的具体用法?C# RoleInfo怎么用?C# RoleInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: CreateContentItem

        /// <summary>
        /// This should only run after the Post exists in the data store. 
        /// </summary>
        /// <returns>The newly created ContentItemID from the data store.</returns>
        /// <remarks>This is for the first question in the thread. Not for replies or items with ParentID > 0.</remarks>
        internal ContentItem CreateContentItem(RoleInfo objItem, int tabId) {
            var typeController = new ContentTypeController();
            string contentTypeName = "DNNCorp_SocialGroup";
            if (objItem.RoleID > 0) {
                contentTypeName = "DNNCorp_SocialGroup";
            }
            var colContentTypes = (from t in typeController.GetContentTypes() where t.ContentType == contentTypeName select t);
            int contentTypeID;

            if (colContentTypes.Count() > 0) {
                var contentType = colContentTypes.Single();
                contentTypeID = contentType == null ? CreateContentType(contentTypeName) : contentType.ContentTypeId;
            } else {
                contentTypeID = CreateContentType(contentTypeName);
            }

            var objContent = new ContentItem {
                Content = objItem.RoleName,
                ContentTypeId = contentTypeID,
                Indexed = false,
                ContentKey = "GroupId=" + objItem.RoleID,
                ModuleID = -1,
                TabID = tabId
            };

            objContent.ContentItemId = Util.GetContentController().AddContentItem(objContent);

            // Add Terms
            //var cntTerm = new Terms();
            //cntTerm.ManageQuestionTerms(objPost, objContent);

            return objContent;
        }
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:38,代码来源:Content.cs

示例2: AddGroupNotification

        internal virtual Notification AddGroupNotification(string notificationTypeName, int tabId, int moduleId, RoleInfo group, UserInfo initiatingUser, IList<RoleInfo> moderators, IList<UserInfo> recipients) {
            var notificationType = NotificationsController.Instance.GetNotificationType(notificationTypeName);
            var tokenReplace = new GroupItemTokenReplace(group);

            var subject = Localization.GetString(notificationTypeName + ".Subject", Constants.SharedResourcesPath);
            subject = tokenReplace.ReplaceGroupItemTokens(subject);

            var body = Localization.GetString(notificationTypeName + ".Body", Constants.SharedResourcesPath);
            
            body = tokenReplace.ReplaceGroupItemTokens(body);
            body = body.Replace("Public.Text", Localization.GetString("Public.Text", Constants.SharedResourcesPath));
            body = body.Replace("Private.Text", Localization.GetString("Private.Text", Constants.SharedResourcesPath));

            bool dismiss = notificationTypeName != Constants.GroupPendingNotification;
            var notification = new Notification
                                   {
                                       NotificationTypeID = notificationType.NotificationTypeId,
                                       Subject = subject,
                                       Body = body,
                                       IncludeDismissAction = dismiss,
                                       SenderUserID = initiatingUser.UserID,
                                       Context = String.Format("{0}:{1}:{2}", tabId, moduleId, group.RoleID)
                                   };
            NotificationsController.Instance.SendNotification(notification, initiatingUser.PortalID, moderators, recipients);

            return notification;
        }
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:27,代码来源:Notifications.cs

示例3: CreateJournalEntry

        public static void CreateJournalEntry(RoleInfo roleInfo, UserInfo createdBy)
        {
            var journalController = JournalController.Instance;
            var journalItem = new JournalItem();
            
            string url = "";
            
            if (roleInfo.Settings.ContainsKey("URL"))
            {
                url = roleInfo.Settings["URL"];
            }

            journalItem.PortalId = roleInfo.PortalID;
            journalItem.ProfileId = createdBy.UserID;
            journalItem.UserId = createdBy.UserID;
            journalItem.Title = roleInfo.RoleName;
            journalItem.ItemData = new ItemData {Url = url};
            journalItem.SocialGroupId = roleInfo.RoleID;
            journalItem.Summary = roleInfo.Description;
            journalItem.Body = null;
            journalItem.JournalTypeId = journalController.GetJournalType("groupcreate").JournalTypeId;
            journalItem.ObjectKey = string.Format("groupcreate:{0}:{1}", roleInfo.RoleID.ToString(CultureInfo.InvariantCulture), createdBy.UserID.ToString(CultureInfo.InvariantCulture));
            
            if (journalController.GetJournalItemByKey(roleInfo.PortalID, journalItem.ObjectKey) != null)
                journalController.DeleteJournalItemByKey(roleInfo.PortalID, journalItem.ObjectKey);
            
            
            journalItem.SecuritySet = string.Empty;
            
            if (roleInfo.IsPublic)
                journalItem.SecuritySet += "E,";
            
            
            journalController.SaveJournalItem(journalItem, -1);
        }
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:35,代码来源:GroupUtilities.cs

示例4: CreateRole

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// CreateRole persists a Role to the Data Store
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="role">The role to persist to the Data Store.</param>
        /// <returns>A Boolean indicating success or failure.</returns>
        /// -----------------------------------------------------------------------------
        public override bool CreateRole(RoleInfo role)
        {
            try
            {
                role.RoleID =
                    Convert.ToInt32(dataProvider.AddRole(role.PortalID,
                                                         role.RoleGroupID,
                                                         role.RoleName,
                                                         role.Description,
                                                         role.ServiceFee,
                                                         role.BillingPeriod.ToString(CultureInfo.InvariantCulture),
                                                         role.BillingFrequency,
                                                         role.TrialFee,
                                                         role.TrialPeriod,
                                                         role.TrialFrequency,
                                                         role.IsPublic,
                                                         role.AutoAssignment,
                                                         role.RSVPCode,
                                                         role.IconFile,
                                                         UserController.GetCurrentUserInfo().UserID,
                                                         (int)role.Status,
                                                         (int)role.SecurityMode,
                                                         role.IsSystemRole));
            }
            catch (SqlException e)
            {
                throw new ArgumentException(e.ToString());
            }

            return true;
        }
开发者ID:rrsc,项目名称:Dnn.Platform,代码行数:40,代码来源:DNNRoleProvider.cs

示例5: 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

示例6: GroupViewParser

 public GroupViewParser(PortalSettings portalSettings, RoleInfo roleInfo, UserInfo currentUser, string template, int groupViewTabId)
 {
     PortalSettings = portalSettings;
     RoleInfo = roleInfo;
     CurrentUser = currentUser;
     Template = template;
     GroupViewTabId = groupViewTabId;
 }
开发者ID:revellado,项目名称:privateSocialGroups,代码行数:8,代码来源:GroupViewParser.cs

示例7: CreateRole

        public virtual bool CreateRole(RoleInfo role)
        {
            #pragma warning disable 612,618

            return CreateRole(-1, ref role);

            #pragma warning restore 612,618
        }
开发者ID:rrsc,项目名称:Dnn.Platform,代码行数:8,代码来源:RoleProvider.cs

示例8: DeleteRole

        public virtual void DeleteRole(RoleInfo role)
        {
            #pragma warning disable 612,618

            DeleteRole(-1, ref role);

            #pragma warning restore 612,618
        }
开发者ID:rrsc,项目名称:Dnn.Platform,代码行数:8,代码来源:RoleProvider.cs

示例9: GivenThereIsAPageCalled

        public void GivenThereIsAPageCalled(string pageName, Table permissions)
        {
            var reset = false;
            var tabController = new TabController();
            var tab = tabController.GetTabByName(pageName, PortalId);
            if (tab == null)
            {
                tab = new TabInfo
                {
                    TabName = pageName,
                    PortalID = 0
                };
                tab.TabID = tabController.AddTab(tab);
                foreach (var row in permissions.Rows)
                {
                    var roleId = -1;
                    var roleController = new RoleController();
                    if (row[0] == "All Users")
                    {
                        roleId = -1;
                    }
                    else
                    {
                        var role = roleController.GetRoleByName(PortalId, row[0]);
                        if (role == null)
                        {
                            if (roleController.GetRoleByName(Null.NullInteger, row[0]) == null)
                            {
                                role = new RoleInfo { RoleName = row[0], RoleGroupID = Null.NullInteger };
                                roleId = roleController.AddRole(role);
                            }
                        }
                    }
                    var permissionController = new PermissionController();
                    var permission = permissionController.GetPermissionByCodeAndKey("SYSTEM_TAB", row[1]);
                    var tabPermission = new TabPermissionInfo
                    {
                        PermissionID = 3,
                        TabID = tab.TabID,
                        AllowAccess = true,
                        RoleID = roleId
                    };
                    tab.TabPermissions.Add(tabPermission);
                }

                tabController.UpdateTab(tab);
                reset = true;
            }
            Page = tab;
            if (reset)
            {
                Config.Touch();
            }
        }
开发者ID:biganth,项目名称:Curt,代码行数:54,代码来源:PageSteps.cs

示例10: PermissionViewModel

 /// <summary>
 /// Constructs a PermissionViewModel from a Permission (for role) object.
 /// </summary>
 /// <param name="permission">Permiso.</param>
 /// <param name="rol">Rol con el que se construye el permiso.</param>
 /// <param name="resourceGroupId">Grupo al que pertenece.</param>
 public PermissionViewModel(Permission permission, RoleInfo rol, Guid resourceGroupId)
 {
     PermissionId = permission?.PermissionId ?? 0;
     ResourceGroupId = resourceGroupId;
     RolId = rol.RoleID;
     RoleName = rol.RoleName;
     ReadPermission = permission != null && permission.ReadPermission;
     WritePermission = permission != null && permission.WritePermission;
     Cd = permission?.Cd ?? DateTime.Now;
     Cu = permission?.Cu ?? Common.CurrentUser.UserID;
     Md = permission?.Md ?? DateTime.Now;
     Mu = permission?.Mu ?? Common.CurrentUser.UserID;
 }
开发者ID:intelequia,项目名称:IntelequiaVault,代码行数:19,代码来源:PermissionViewModel.cs

示例11: AddRole

        /// <summary>
        /// This overload adds a role and optionally adds the info to the AspNet Roles
        /// </summary>
        /// <param name="objRoleInfo">The Role to Add</param>
        /// <returns>The Id of the new role</returns>
        public int AddRole(RoleInfo objRoleInfo)
        {
            int roleId = -1;
            bool success = provider.CreateRole(objRoleInfo.PortalID, ref objRoleInfo);

            if (success)
            {
                AutoAssignUsers(objRoleInfo);
                roleId = objRoleInfo.RoleID;
            }

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

示例12: Index

        public ActionResult Index()
        {
            var moduleID = int.Parse(PortalController.GetPortalSetting("MyDnnLiveChatModuleID", PortalSettings.PortalId, "-1"));

            if (moduleID == -1)
            {
                moduleID = ActiveModule.ModuleID;
                PortalController.UpdatePortalSetting(PortalSettings.PortalId, "MyDnnLiveChatModuleID", moduleID.ToString(), true);

                var role = RoleController.Instance.GetRoleByName(PortalSettings.PortalId, "MyDnnSupportAgent");
                if (role == null)
                {
                    var objRoleInfo = new RoleInfo();
                    objRoleInfo.PortalID = PortalSettings.PortalId;
                    objRoleInfo.Description = "mydnn live chat agent";
                    objRoleInfo.RoleName = "MyDnnSupportAgent";
                    objRoleInfo.IsPublic = false;
                    objRoleInfo.Status = RoleStatus.Approved;
                    objRoleInfo.RoleGroupID = Null.NullInteger;
                    RoleController.Instance.AddRole(objRoleInfo);

                    var listeners = VisitorsOnlineApi.Instance.GetListeners(PortalSettings.PortalId);
                    if (listeners == null || !listeners.Any(l => l.RoleName == "MyDnnSupportAgent" && l.LoginState == VisitorsOnline.Components.Enums.LoginState.LoggedIn))
                    {
                        VisitorsOnlineApi.Instance.AddListener(new ListenerInfo()
                        {
                            PortalID = PortalSettings.PortalId,
                            RoleName = "MyDnnSupportAgent",
                            LoginState = VisitorsOnline.Components.Enums.LoginState.LoggedIn,
                            InvokeScript = "$('#mydnnLiveChatMinButton').find('[data-livechat-isonline]').hide();$('#mydnnLiveChatMinButton').find('[data-livechat-isonline=\"online\"]').show();",
                            CreatedByModuleName = "MyDnnSupportLiveChat",
                            CreatedOnDate = DateTime.Now
                        });
                    }
                    if (listeners == null || !listeners.Any(l => l.RoleName == "MyDnnSupportAgent" && l.LoginState == VisitorsOnline.Components.Enums.LoginState.LoggedOff))
                    {
                        VisitorsOnlineApi.Instance.AddListener(new ListenerInfo()
                        {
                            PortalID = PortalSettings.PortalId,
                            RoleName = "MyDnnSupportAgent",
                            LoginState = VisitorsOnline.Components.Enums.LoginState.LoggedOff,
                            InvokeScript = "$('#mydnnLiveChatMinButton').find('[data-livechat-isonline]').hide();$('#mydnnLiveChatMinButton').find('[data-livechat-isonline=\"offline\"]').show();",
                            CreatedByModuleName = "MyDnnSupportLiveChat",
                            CreatedOnDate = DateTime.Now
                        });
                    }
                }
            }

            return View();
        }
开发者ID:mydnn,项目名称:LiveChat,代码行数:51,代码来源:HomeController.cs

示例13: GroupInfo

        public GroupInfo(RoleInfo roleInfo) {
            RoleID = roleInfo.RoleID;
            RoleName = roleInfo.RoleName;
            Description = roleInfo.Description;
            PortalID = roleInfo.PortalID;
            SecurityMode = roleInfo.SecurityMode;
            ServiceFee = roleInfo.ServiceFee;
            RSVPCode = roleInfo.RSVPCode;

          



        }
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:14,代码来源:GroupInfo.cs

示例14: UpdateContentItem

        /// <summary>
        /// This is used to update the content in the ContentItems table. Should be called when a question is updated.
        /// </summary>
        internal void UpdateContentItem(RoleInfo objItem, int tabId) {
            ContentItem objContent = null; //Util.GetContentController().;

            if (objContent == null) return;
            objContent.Content = objItem.RoleName;
            objContent.TabID = tabId;
            objContent.ContentKey = "GroupId=" + objItem.RoleID; // we reset this just in case the page changed.

            Util.GetContentController().UpdateContentItem(objContent);

            // Update Terms
            //var cntTerm = new Terms();
            //cntTerm.ManageQuestionTerms(objPost, objContent);
        }
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:17,代码来源:Content.cs

示例15: GetEnabled

        /// <summary>
        /// Gets the Enabled status of the permission
        /// </summary>
        /// <param name="objPerm">The permission being loaded</param>
        /// <param name="role">The role</param>
        /// <param name="column">The column of the Grid</param>
        protected override bool GetEnabled( PermissionInfo objPerm, RoleInfo role, int column )
        {
            bool enabled;

            if( role.RoleID == AdministratorRoleId )
            {
                enabled = false;
            }
            else
            {
                enabled = true;
            }

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


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