Пример #1
0
        /// -----------------------------------------------------------------------------
        /// <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);
            }
        }
        public HttpResponseMessage RejectGroup(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 notifications = new Notifications();
                var roleCreator = UserController.GetUserById(PortalSettings.PortalId, _roleInfo.CreatedByUserID);
                var siteAdmin = UserController.GetUserById(PortalSettings.PortalId, PortalSettings.AdministratorId);
                notifications.AddGroupNotification(Constants.GroupRejectedNotification, _tabId, _moduleId, _roleInfo, siteAdmin, new List<RoleInfo> { _roleInfo }, roleCreator);

                var roleController = new RoleController();
                roleController.DeleteRole(_roleId, PortalSettings.PortalId);
                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);
            }
        }
Пример #3
0
        public ActionResult RejectGroup(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 notifications = new Notifications();
                var roleCreator = UserController.GetUserById(PortalSettings.PortalId, roleInfo.CreatedByUserID);
                var siteAdmin = UserController.GetUserById(PortalSettings.PortalId, PortalSettings.AdministratorId);
                notifications.AddGroupNotification(Constants.GroupRejectedNotification, TabId, ModuleId, roleInfo, siteAdmin, new List<RoleInfo> { roleInfo }, roleCreator);

                var roleController = new RoleController();
                roleController.DeleteRole(RoleId, PortalSettings.PortalId);
                NotificationsController.Instance.DeleteAllNotificationRecipients(notificationId);
                return Json(new { Result = "success" });
            }
            catch (Exception exc)
            {
                DnnLog.Error(exc);
                return Json(new { Result = "error" });
            }
        }
Пример #4
0
        /// <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 cmdDelete_Click( object sender, EventArgs e )
        {
            try
            {
                RoleController objUser = new RoleController();

                objUser.DeleteRole( RoleID, PortalSettings.PortalId );
                EventLogController objEventLog = new EventLogController();
                objEventLog.AddLog( "RoleID", RoleID.ToString(), PortalSettings, UserId, EventLogController.EventLogType.ROLE_DELETED );

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

                Response.Redirect( Globals.NavigateURL() );
            }
            catch( Exception exc ) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException( this, exc );
            }
        }