• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Roles.RoleController类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



RoleController类属于DotNetNuke.Security.Roles命名空间,在下文中一共展示了RoleController类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: DeleteUserRoleInternal

        private static bool DeleteUserRoleInternal(int portalId, int userId, int roleId)
        {
            var roleController = new RoleController();
            var user = UserController.GetUserById(portalId, userId);
            var userRole = roleController.GetUserRole(portalId, userId, roleId);
            var portalController = new PortalController();
            bool delete = true;
            var portal = portalController.GetPortal(portalId);
            if (portal != null && userRole != null)
            {
                if (CanRemoveUserFromRole(portal, userId, roleId))
                {
                    provider.RemoveUserFromRole(portalId, user, userRole);
                    var objEventLog = new EventLogController();
                    objEventLog.AddLog(userRole, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.ROLE_UPDATED);

                    //Remove the UserInfo from the Cache, as it has been modified
                    DataCache.ClearUserCache(portalId, user.Username);
                    TestableRoleController.Instance.ClearRoleCache(portalId);
                }
                else
                {
                    delete = false;
                }
            }
            return delete;
        }
开发者ID:hungnt-me,项目名称:Dnn.Platform,代码行数:27,代码来源:RoleController.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: 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


示例5: Save_Click

        private void Save_Click(object sender, EventArgs e)
        {
            if (GroupId > 0)
            {
                RoleController roleController = new RoleController();
                Security.PortalSecurity ps = new Security.PortalSecurity();
                txtDescription.Text = ps.InputFilter(txtDescription.Text, Security.PortalSecurity.FilterFlag.NoScripting);
                txtDescription.Text = ps.InputFilter(txtDescription.Text, Security.PortalSecurity.FilterFlag.NoMarkup);
                var roleInfo = roleController.GetRole(GroupId, PortalId);
                if (roleInfo != null)
                {
                    roleInfo.Description = txtDescription.Text;
                    roleInfo.IsPublic = rdAccessTypePublic.Checked;
                    if (roleInfo.Settings.ContainsKey("URL"))
                    {
                        roleInfo.Settings["URL"] = Globals.NavigateURL(TabId, "", new String[] { "groupid=" + roleInfo.RoleID.ToString() });
                    } else
                    {
                        roleInfo.Settings.Add("URL", Globals.NavigateURL(TabId, "", new String[] { "groupid=" + roleInfo.RoleID.ToString() }));
                    }
                    if (roleInfo.Settings.ContainsKey("ReviewMembers"))
                    {
                        roleInfo.Settings["ReviewMembers"] = chkMemberApproved.Checked.ToString();
                    } else
                    {
                        roleInfo.Settings.Add("ReviewMembers", chkMemberApproved.Checked.ToString());
                    }
                    TestableRoleController.Instance.UpdateRoleSettings(roleInfo, true);
                    roleController.UpdateRole(roleInfo);

                    if (inpFile.PostedFile.ContentLength > 0)
                    {
                        IFileManager _fileManager = FileManager.Instance;
                        IFolderManager _folderManager = FolderManager.Instance;
                        var rootFolderPath = PathUtils.Instance.FormatFolderPath(PortalSettings.HomeDirectory);

                        IFolderInfo groupFolder = _folderManager.GetFolder(PortalSettings.PortalId, "Groups/" + roleInfo.RoleID);
                        if (groupFolder == null)
                        {
                            groupFolder = _folderManager.AddFolder(PortalSettings.PortalId, "Groups/" + roleInfo.RoleID);
                        }
                        if (groupFolder != null)
                        {
                            var fileName = Path.GetFileName(inpFile.PostedFile.FileName);
                            var fileInfo = _fileManager.AddFile(groupFolder, fileName, inpFile.PostedFile.InputStream, true);
                            roleInfo.IconFile = "FileID=" + fileInfo.FileId;
                            roleController.UpdateRole(roleInfo);
                        }
                    }

                }
                Response.Redirect(Globals.NavigateURL(TabId, "", new String[] { "groupid=" + GroupId.ToString() }));
            }
        }
开发者ID:biganth,项目名称:Curt,代码行数:54,代码来源:GroupEdit.ascx.cs


示例6: GetStaffNames

 public void GetStaffNames(int portalid, string term)
 {
     term = term.ToLower();
     var result = new DotNetNuke.Security.Roles.RoleController().GetUsersByRole(portalid, "Staff")
         .Where(w => w.DisplayName.ToLower().Contains(term) && w.IsDeleted==false)
         .Select(s => new { label = s.DisplayName, value = s.UserID })
         .OrderBy(o => o.label);
     string json = JsonConvert.SerializeObject(result);
     HttpContext.Current.Response.ContentType = "application/json";
     HttpContext.Current.Response.Write(json);
 }
开发者ID:powertochange-org,项目名称:acReimbursements,代码行数:11,代码来源:WebService.cs


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


示例8: DataBind

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// DataBind binds the data to the controls
        /// </summary>
        /// <history>
        /// 	[cnurse]	03/13/2006  Created
        /// </history>
        /// -----------------------------------------------------------------------------
        public override void DataBind()
        {
            if (Request.IsAuthenticated)
            {
                RoleController roleController = new RoleController();
                grdServices.DataSource = roleController.GetUserRoles(UserInfo, false);
                grdServices.DataBind();

                //if no service available then hide options
                ServicesRow.Visible = (grdServices.Items.Count > 0);
            }
        }
开发者ID:nguyenppt,项目名称:1pubcreditnew,代码行数:20,代码来源:MemberServices.ascx.cs


示例9: AddClientEditorRole

 public void AddClientEditorRole()
 {
     if (_userInfo != null)
     {
         if (!_userInfo.IsInRole(StoreSettings.ClientEditorRole))
         {
             var rc = new DotNetNuke.Security.Roles.RoleController();
             var ri = rc.GetRoleByName(PortalId, StoreSettings.ClientEditorRole);
             if (ri != null) rc.AddUserRole(PortalId, _userInfo.UserID, ri.RoleID, Null.NullDate, Null.NullDate);
             if (StoreSettings.Current.Get("sendclientroleemail") == "True") NBrightBuyUtils.SendEmail(_userInfo.Email, "addclientrole.html", _clientInfo, "", "", _userInfo.Profile.PreferredLocale);
         }
     }
 }
开发者ID:DNNMonster,项目名称:NBrightBuy,代码行数:13,代码来源:ClientData.cs


示例10: OnLoad

        /// -----------------------------------------------------------------------------
        /// <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 override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            cmdCancel.Click += cmdCancel_Click;
            cmdDelete.Click += cmdDelete_Click;
            cmdUpdate.Click += cmdUpdate_Click;

            try
            {
                if ((Request.QueryString["RoleGroupID"] != null))
                {
                    RoleGroupID = Int32.Parse(Request.QueryString["RoleGroupID"]);
                }
                if (Page.IsPostBack == false)
                {
                    ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem"));
                    var objRoles = new RoleController();
                    if (RoleGroupID != -1)
                    {
                        RoleGroupInfo objRoleGroupInfo = RoleController.GetRoleGroup(PortalId, RoleGroupID);
                        if (objRoleGroupInfo != null)
                        {
                            txtRoleGroupName.Text = objRoleGroupInfo.RoleGroupName;
                            txtDescription.Text = objRoleGroupInfo.Description;

                            //Check if Group has any roles assigned
                            int roleCount = objRoles.GetRolesByGroup(PortalId, RoleGroupID).Count;

                            if (roleCount > 0)
                            {
                                cmdDelete.Visible = false;
                            }
                        }
                        else //security violation attempt to access item not related to this Module
                        {
                            Response.Redirect(Globals.NavigateURL("Security Roles"));
                        }
                    }
                    else
                    {
                        cmdDelete.Visible = false;
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
开发者ID:rickfox,项目名称:Steves,代码行数:61,代码来源:EditGroups.ascx.cs


示例11: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            DotNetNuke.Framework.jQuery.RegisterDnnJQueryPlugins(this.Page);

            imgGroup.Src = Page.ResolveUrl("~/DesktopModules/SocialGroups/Images/") + "sample-group-profile.jpg";
            if (!Page.IsPostBack && GroupId > 0)
            {
                RoleController roleController = new RoleController();
                var roleInfo = roleController.GetRole(GroupId, PortalId);

                if (roleInfo != null)
                {
                    if (!UserInfo.IsInRole(PortalSettings.AdministratorRoleName))
                    {
                        if (roleInfo.CreatedByUserID != UserInfo.UserID)
                        {
                            Response.Redirect(ModuleContext.NavigateUrl(TabId, "", false, new String[] { "groupid=" + GroupId.ToString() }));
                        }
                    }

                    txtGroupName.Visible = !roleInfo.IsSystemRole;
                    reqGroupName.Enabled = !roleInfo.IsSystemRole;

                    if(!roleInfo.IsSystemRole)
                        txtGroupName.Text = roleInfo.RoleName;
                    else
                        litGroupName.Text = roleInfo.RoleName;
                    
                    txtDescription.Text = roleInfo.Description;
                    rdAccessTypePrivate.Checked = !roleInfo.IsPublic;
                    rdAccessTypePublic.Checked = roleInfo.IsPublic;
                    

                    if (roleInfo.Settings.ContainsKey("ReviewMembers"))
                    {
                        chkMemberApproved.Checked = Convert.ToBoolean(roleInfo.Settings["ReviewMembers"].ToString());
                    }
                    imgGroup.Src = roleInfo.PhotoURL;
                }
                else
                {
                    Response.Redirect(ModuleContext.NavigateUrl(TabId, "", false));
                }
            }
        }
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:45,代码来源:GroupEdit.ascx.cs


示例12: OnDeleteClick

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// cmdDelete_Click runs when the delete Button is clicked
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// 	[cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void OnDeleteClick(object sender, EventArgs e)
        {
            try
            {
                var objUser = new RoleController();

                objUser.DeleteRole(_roleID, PortalSettings.PortalId);

                //Clear Roles Cache
                DataCache.RemoveCache("GetRoles");

                Response.Redirect(Globals.NavigateURL());
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
开发者ID:patonomatic,项目名称:VUWTC,代码行数:29,代码来源:EditRoles.ascx.cs


示例13: AddGroupOwnerNotification

        internal virtual Notification AddGroupOwnerNotification(string notificationTypeName, int tabId, int moduleId, RoleInfo group, UserInfo initiatingUser) 
        {
            var notificationType = NotificationsController.Instance.GetNotificationType(notificationTypeName);

            var tokenReplace = new GroupItemTokenReplace(group);
            
            var subject = Localization.GetString(notificationTypeName + ".Subject", Constants.SharedResourcesPath);
            var body = Localization.GetString(notificationTypeName + ".Body", Constants.SharedResourcesPath);
            subject = subject.Replace("[DisplayName]", initiatingUser.DisplayName);
            subject = subject.Replace("[ProfileUrl]", Globals.UserProfileURL(initiatingUser.UserID));
            subject = tokenReplace.ReplaceGroupItemTokens(subject);
            body = body.Replace("[DisplayName]", initiatingUser.DisplayName);
            body = body.Replace("[ProfileUrl]", Globals.UserProfileURL(initiatingUser.UserID));
            body = tokenReplace.ReplaceGroupItemTokens(body);
            var roleCreator = UserController.GetUserById(group.PortalID, group.CreatedByUserID);

            var roleOwners = new List<UserInfo>();

            var rc = new RoleController();
            foreach (UserInfo userInfo in rc.GetUsersByRoleName(group.PortalID, group.RoleName)) {
                var userRoleInfo = rc.GetUserRole(group.PortalID, userInfo.UserID, group.RoleID);
                if (userRoleInfo.IsOwner && userRoleInfo.UserID != group.CreatedByUserID)
                {
                    roleOwners.Add(UserController.GetUserById(group.PortalID, userRoleInfo.UserID));
                }
            }
            roleOwners.Add(roleCreator);
            


            //Need to add from sender details
            var notification = new Notification
            {
                NotificationTypeID = notificationType.NotificationTypeId,
                Subject = subject,
                Body = body,
                IncludeDismissAction = true,
                SenderUserID = initiatingUser.UserID,
                Context = String.Format("{0}:{1}:{2}:{3}", tabId, moduleId, group.RoleID, initiatingUser.UserID)
            };
            NotificationsController.Instance.SendNotification(notification, initiatingUser.PortalID, null, roleOwners);

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


示例14: CreateGroupFolder

        public File CreateGroupFolder(int roleID, int portalID, UserInfo currentUser)
        {
            FileController ctrl = new FileController();
            File rootGroupFolder = new File();

            //rootGroupFolder.ChildCount = 0;
            rootGroupFolder.CreatedByUserID = currentUser.UserID;
            rootGroupFolder.CreatedByUserName = currentUser.DisplayName;
            rootGroupFolder.CreatedDate = System.DateTime.Now;
            rootGroupFolder.IsInTrash = false;
            rootGroupFolder.IsFolder = true;
            rootGroupFolder.ItemType = 0;
            rootGroupFolder.LastModifiedByUserID = currentUser.UserID;
            rootGroupFolder.LastModifiedByUserName = currentUser.DisplayName;
            rootGroupFolder.LastModifiedDate = System.DateTime.Now;
            RoleController ctrlRole = new RoleController();
            RoleInfo role = ctrlRole.GetRole(roleID, portalID);
            rootGroupFolder.Name = role.RoleName;
            rootGroupFolder.ParentID = GetRootGroupsFolder(portalID, currentUser.UserID).ID;
            rootGroupFolder.PortalID = portalID;
            rootGroupFolder.RoleID = roleID;

            ctrl.Create(rootGroupFolder);

            Permission permission = new Permission();
            permission.CanAddFiles = true;
            permission.CanAddFolders = true;
            permission.CanDelete = false;
            permission.CanModify = false;
            permission.CanModifyPermission = false;
            permission.CanSee = true;
            permission.FileID = rootGroupFolder.ID;
            permission.ModuleID = 0;
            permission.PortalID = portalID;
            permission.RoleID = role.RoleID;
            permission.RoleName = role.RoleName;

            PermissionController ctrlPerm = new PermissionController();
            ctrlPerm.Create(permission);

            return rootGroupFolder;
        }
开发者ID:heitkea,项目名称:DNN_DEV_7_2,代码行数:42,代码来源:FileController.cs


示例15: ApproveGroup

        public ActionResult ApproveGroup(int notificationId)
        {
            try
            {
                var recipient = InternalMessagingController.Instance.GetMessageRecipient(notificationId, UserInfo.UserID);
                if (recipient == null) return Json(new { Result = "error" });

                var notification = NotificationsController.Instance.GetNotification(notificationId);
                ParseKey(notification.Context);
                if (roleInfo == null)
                {
                    return Json(new { Result = "error" });
                }
                if (!IsMod())
                {
                    return Json(new { Result = "access denied" });
                }
                var roleController = new RoleController();
                roleInfo.Status = RoleStatus.Approved;
                roleController.UpdateRole(roleInfo);
                var roleCreator = UserController.GetUserById(PortalSettings.PortalId, roleInfo.CreatedByUserID);
                //Update the original creator's role
                roleController.UpdateUserRole(PortalSettings.PortalId, roleCreator.UserID, roleInfo.RoleID, RoleStatus.Approved, true, false);
                GroupUtilities.CreateJournalEntry(roleInfo, roleCreator);

                var notifications = new Notifications();
                var siteAdmin = UserController.GetUserById(PortalSettings.PortalId, PortalSettings.AdministratorId);
                notifications.AddGroupNotification(Constants.GroupApprovedNotification, TabId, ModuleId, roleInfo, siteAdmin, new List<RoleInfo> { roleInfo });
                NotificationsController.Instance.DeleteAllNotificationRecipients(notificationId);

                return Json(new { Result = "success" });
            }
            catch (Exception exc)
            {
                DnnLog.Error(exc);
                return Json(new { Result = "error" });
            }
        }
开发者ID:biganth,项目名称:Curt,代码行数:38,代码来源:GroupServices.cs


示例16: ApproveGroup

        public HttpResponseMessage ApproveGroup(NotificationDTO postData)
        {
            try
            {
                var recipient = InternalMessagingController.Instance.GetMessageRecipient(postData.NotificationId, UserInfo.UserID);
                if (recipient == null) return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Unable to locate recipient");

                var notification = NotificationsController.Instance.GetNotification(postData.NotificationId);
                ParseKey(notification.Context);
                if (_roleInfo == null)
                {
                    return  Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Unable to locate role");
                }
                if (!IsMod())
                {
                    return Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "Not Authorized!");
                }
                var roleController = new RoleController();
                _roleInfo.Status = RoleStatus.Approved;
                roleController.UpdateRole(_roleInfo);
                var roleCreator = UserController.GetUserById(PortalSettings.PortalId, _roleInfo.CreatedByUserID);
                //Update the original creator's role
                roleController.UpdateUserRole(PortalSettings.PortalId, roleCreator.UserID, _roleInfo.RoleID, RoleStatus.Approved, true, false);
                GroupUtilities.CreateJournalEntry(_roleInfo, roleCreator);

                var notifications = new Notifications();
                var siteAdmin = UserController.GetUserById(PortalSettings.PortalId, PortalSettings.AdministratorId);
                notifications.AddGroupNotification(Constants.GroupApprovedNotification, _tabId, _moduleId, _roleInfo, siteAdmin, new List<RoleInfo> { _roleInfo });
                NotificationsController.Instance.DeleteAllNotificationRecipients(postData.NotificationId);

                return Request.CreateResponse(HttpStatusCode.OK, new {Result = "success"});
            }
            catch (Exception exc)
            {
                Logger.Error(exc);
                return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc);
            }
        }
开发者ID:hungnt-me,项目名称:Dnn.Platform,代码行数:38,代码来源:ModerationServiceController.cs


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


示例18: DataBind

        /// <summary>
        /// DataBind binds the data to the controls
        /// </summary>
        /// <history>
        /// 	[cnurse]	03/13/2006  Created
        /// </history>
        public override void DataBind()
        {
            if( Services == 1 )
            {
                RoleController objRoles = new RoleController();
                grdServices.DataSource = objRoles.GetUserRoles( PortalId );
                grdServices.DataBind();

                if( grdServices.Items.Count != 0 )
                {
                    lblServices.Text = string.Format( Localization.GetString( "PleaseRegister", this.LocalResourceFile ), Globals.GetPortalDomainName( PortalAlias.HTTPAlias, Request, true ) + "/" + Globals.glbDefaultPage, TabId );
                }
                else
                {
                    grdServices.Visible = false;
                    lblServices.Text = Localization.GetString( "MembershipNotOffered", this.LocalResourceFile );
                }
                lblServices.Visible = true;

                grdServices.Columns[0].Visible = false; // subscribe
                grdServices.Columns[9].Visible = false; // expiry date
            }
            else
            {
                if( Request.IsAuthenticated )
                {
                    RoleController objRoles = new RoleController();

                    grdServices.DataSource = objRoles.GetUserRoles( PortalId, UserInfo.UserID, false );
                    grdServices.DataBind();

                    // if no service available then hide options
                    //ServicesRow.Visible = (grdServices.Items.Count > 0)
                }
            }
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:42,代码来源:MemberServices.ascx.cs


示例19: LoadSettings

        /// <summary>
        /// Load All Editor Settings
        /// </summary>
        /// <param name="currentMode">The current mode.</param>
        /// <param name="changeMode">if set to <c>true</c> [change mode].</param>
        private void LoadSettings(int currentMode, bool changeMode = true)
        {
            this.CurrentSettingsMode = (SettingsMode)Enum.Parse(typeof(SettingsMode), currentMode.ToString());

            this.lnkRemoveAll.Visible = !currentMode.Equals(0);
            this.lnkRemoveChild.Visible = !currentMode.Equals(0);
            this.CopyToAllChild.Visible = !currentMode.Equals(0);

            this.lnkRemove.Text = string.Format(
                Localization.GetString("Remove.Text", this.ResXFile, this.LangCode),
                this.rBlSetMode.Items[currentMode].Text);
            this.lnkRemoveAll.Text =
                string.Format(
                    Localization.GetString("RemoveAll.Text", this.ResXFile, this.LangCode),
                    this.rBlSetMode.Items[currentMode].Text);

            this.lnkRemove.ToolTip = string.Format(
                Localization.GetString("Remove.Help", this.ResXFile, this.LangCode),
                this.rBlSetMode.Items[currentMode].Text);
            this.lnkRemoveAll.ToolTip =
                string.Format(
                    Localization.GetString("RemoveAll.Help", this.ResXFile, this.LangCode),
                    this.rBlSetMode.Items[currentMode].Text);

            this.LoadDefaultSettings();

            var settingsDictionary = Utility.GetEditorHostSettings();
            var portalRoles = new RoleController().GetPortalRoles(this._portalSettings.PortalId);

            var portalKey = string.Format("DNNCKP#{0}#", this._portalSettings.PortalId);
            var pageKey = string.Format("DNNCKT#{0}#", this.CurrentOrSelectedTabId);
            var moduleKey = string.Format("DNNCKMI#{0}#INS#{1}#", this.ModuleId, this.moduleInstanceName);

            var providerConfiguration = ProviderConfiguration.GetProviderConfiguration("htmlEditor");
            var objProvider = (Provider)providerConfiguration.Providers[providerConfiguration.DefaultProvider];

            var currentSettings = SettingsUtil.GetDefaultSettings(
                this._portalSettings,
                this._portalSettings.HomeDirectoryMapPath,
                objProvider.Attributes["ck_configFolder"],
                portalRoles);

            switch (this.CurrentSettingsMode)
            {
                case SettingsMode.Portal:
                    {
                        // Load Portal Settings ?!
                        if (SettingsUtil.CheckExistsPortalOrPageSettings(settingsDictionary, portalKey))
                        {
                            currentSettings = new EditorProviderSettings();

                            currentSettings = SettingsUtil.LoadPortalOrPageSettings(
                                this._portalSettings, currentSettings, settingsDictionary, portalKey, portalRoles);

                            // Set Current Mode to Portal
                            currentSettings.SettingMode = SettingsMode.Portal;

                            this.lnkRemove.Enabled = true;
                        }
                        else
                        {
                            this.lnkRemove.Enabled = false;
                        }
                    }

                    break;
                case SettingsMode.Page:
                    {
                        // Load Page Settings ?!
                        if (SettingsUtil.CheckExistsPortalOrPageSettings(settingsDictionary, pageKey))
                        {
                            currentSettings = new EditorProviderSettings();

                            currentSettings = SettingsUtil.LoadPortalOrPageSettings(
                                this._portalSettings, currentSettings, settingsDictionary, pageKey, portalRoles);

                            // Set Current Mode to Page
                            currentSettings.SettingMode = SettingsMode.Page;

                            this.lnkRemove.Enabled = true;
                        }
                        else
                        {
                            this.lnkRemove.Enabled = false;
                        }

                        var currentTab = new TabController().GetTab(
                            this.CurrentOrSelectedTabId, this._portalSettings.PortalId, false);

                        this.lnkRemoveChild.Enabled = currentTab.HasChildren;

                        this.lnkRemoveChild.Text = Localization.GetString(
                                "RemovePageChild.Text", this.ResXFile, this.LangCode);
                        this.lnkRemoveChild.ToolTip = Localization.GetString(
                            "RemovePageChild.Help", this.ResXFile, this.LangCode);
//.........这里部分代码省略.........
开发者ID:huoxudong125,项目名称:dnnckeditor,代码行数:101,代码来源:CKEditorOptions.ascx.cs


示例20: BindData


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Roles.RoleInfo类代码示例发布时间:2022-05-24
下一篇:
C# Permissions.PermissionController类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap