Example #1
0
 void Handle(Input.Delete action)
 {
     // TODO: Warning user with Yes/No dialog
     Db.Transact(() => {
         SystemUserAdmin.DeleteSystemUserGroup(this.Data as Simplified.Ring3.SystemUserGroup);
     });
 }
Example #2
0
        void Handle(Input.Delete action)
        {
            SystemUser systemUser = Helper.GetCurrentSystemUser();

            if (systemUser.Equals(this.Data))
            {
                // TODO: Show error message "Can not delete yourself"
                return;
            }

            // TODO: Warning user with Yes/No dialog
            Db.Transact(() => {
                SystemUserAdmin.DeleteSystemUser(this.Data as Simplified.Ring3.SystemUser);
            });
        }
        /// <summary>
        /// Delete System User Group
        /// </summary>
        /// <param name="action"></param>
        void Handle(Input.Delete action)
        {
            // TODO: Warn user with Yes/No dialog
            var transaction = this.Transaction;

            transaction.Scope(() => {
                SystemUserAdmin.DeleteSystemUserGroup(this.Data as Simplified.Ring3.SystemUserGroup);
            });

            if (transaction.IsDirty)
            {
                transaction.Commit();
            }

            this.RedirectUrl = "/UserAdmin/admin/usergroups";
        }
Example #4
0
        /// <summary>
        /// Save event
        /// </summary>
        /// <param name="action"></param>
        void Handle(Input.Save action)
        {
            this.AssurePropertiesMetadata();

            if (this.IsInvalid)
            {
                return;
            }

            try {
                Db.Transact(() => {
                    SystemUserAdmin.AddPerson(this.FirstName, this.LastName, this.Username, this.Password);
                });

                this.RedirectUrl = "/UserAdmin/admin/users";
            } catch (Exception e) {
                this.Message = e.Message;
            }
        }
        /// <summary>
        /// AddUser operation invoked
        /// </summary>
        /// <param name="action"></param>
        void Handle(Input.AddUser action)
        {
            this.AssurePropertyMetadata_AddUserName("AddUserName$", this.AddUserName);
            if (this.AddUser_Feedback != null)
            {
                return;
            }

            Simplified.Ring3.SystemUser systemUser = Db.SQL <Simplified.Ring3.SystemUser>("SELECT o FROM Simplified.Ring3.SystemUser o WHERE o.Username=?", this.AddUserName).First;
            if (systemUser == null)
            {
                PropertyMetadataItem item = new PropertyMetadataItem();
                item.Message          = "User not found";
                item.ErrorLevel       = 1;
                item.PropertyName     = "AddUser$";
                this.AddUser_Feedback = item;
                return;
            }

            SystemUserAdmin.AddSystemUserToSystemUserGroup(systemUser, this.Data);
            this.AddUserName = string.Empty;
        }
Example #6
0
        /// <summary>
        /// Delete user
        /// </summary>
        /// <param name="action"></param>
        void Handle(Input.Delete action)
        {
            var transaction = this.Transaction;

            SystemUser systemUser = Helper.GetCurrentSystemUser();

            if (systemUser.Equals(this.Data))
            {
                // TODO: Show error message "Can not delete yourself"
                return;
            }

            // TODO: Warn user with Yes/No dialog
            transaction.Rollback();

            transaction.Scope(() => {
                SystemUserAdmin.DeleteSystemUser(this.Data as Simplified.Ring3.SystemUser);
            });

            transaction.Commit();

            this.RedirectUrl = "/UserAdmin/admin/users";
        }
        void Handle(Input.Save action)
        {
            if (!CheckPasswordMatch(this.Password, this.ConfirmPassword))
            {
                return;
            }

            if (this.resetPassword == null)
            {
                this.Message = "Reset token already used";
                return;
            }

            if (this.resetPassword.Expire < DateTime.UtcNow)
            {
                this.Message = "Reset token expired";
                // TODO: redirect?
                return;
            }

            if (resetPassword.User == null)
            {
                this.Message = "Failed to get the user"; // TODO: Better message
                return;
            }

            string userID = resetPassword.User.GetObjectID();

            Db.Transact(() => {
                SystemUserAdmin.SetPassword(resetPassword.User, this.Password);
                // Remove resetPassord instance
                resetPassword.Delete();
            });

            this.RedirectUrl = "/UserAdmin/admin/users/" + userID;
        }
 /// <summary>
 /// Remove a SystemUser from the group
 /// </summary>
 /// <param name="action"></param>
 void Handle(Input.Remove action)
 {
     Simplified.Ring3.SystemUserGroup group      = this.Parent.Parent.Data as Simplified.Ring3.SystemUserGroup;
     Simplified.Ring3.SystemUser      systemUser = this.Data as Simplified.Ring3.SystemUser;
     SystemUserAdmin.RemoveSystemUserFromSystemUserGroup(systemUser, group);
 }