コード例 #1
0
        ////-------------------------------------------------------------------------------------------------------------------------------------------------------------
        ///// <summary>
        ///// If deleteExisting groups is true the entered group type will overwrite
        ///// any existing groups assigned to this user. (This is require where
        ///// a user can only belong to one group)
        ///// </summary>
        ///// <param name="updatedUser"></param>
        ///// <param name="groupType"></param>
        ///// <param name="deleteExistingGroups"></param>
        ///// <returns></returns>
        //public bool EditUserPassword(int userID, SecureString Password, MGGroupType groupType, bool p) {
        //    bool result = false;

        //    try {
        //        result = SecurityOperations.UpdateUserPassword(userID, Password, Authorisation.UseMGLRatherThanMySQLPasswordEncryption);

        //        if (result) {
        //            DateTime pWordChangeTimeStamp = DateTime.Now;

        //            SecurityOperations.UpdatePasswordChangeDate(userID, pWordChangeTimeStamp);
        //            // 13-Jul-2015 - lets email the user to confirm that their password has changed!
        //            MGUser u = null;
        //            Authorisation.GetUser(userID, out u);
        //            SecurityOperations.PasswordChangedEmailUser(u, pWordChangeTimeStamp);

        //        }
        //    } catch (Exception ex) {
        //        Logger.Log("Error in UserAdministration.AddUser." + ex.Message);
        //    } finally {
        //        SecurityOperations.Finish();
        //    }

        //    return result;
        //}


        //-------------------------------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// If deleteExisting groups is true the entered group type will overwrite
        /// any existing groups assigned to this user. (This is require where
        /// a user can only belong to one group)
        /// </summary>
        /// <param name="updatedUser"></param>
        /// <param name="groupType"></param>
        /// <param name="deleteExistingGroups"></param>
        /// <returns></returns>
        public bool EditUserDetails(MGUser updatedUser, MGGroupType groupType, bool p)
        {
            bool result = false;

            try {
                result = SecurityOperations.UpdateUserDetails(updatedUser.ID, updatedUser.Username, updatedUser.Email, updatedUser.JobTitle,
                                                              updatedUser.Organisation, updatedUser.OrganisationID, updatedUser.Telephone);

                //need to add the user to the user_groups xref's
                result = result && SecurityOperations.DeleteUsersGroupXrefs(updatedUser.ID);
                result = result && SecurityOperations.UpdateUserToGroupXref(updatedUser.Username, groupType);

                //need to update the applications user to group to  xref's
                if (result)
                {
                    UserOperations userOps = new UserOperations(MGLApplicationSecurityInterface.Instance().DatabaseConfig);

                    Dictionary <int, List <int> > userGroupDict = userOps.UserGroupDictionary();
                    userOps.Finish();

                    MGLApplicationSecurityInterface.Instance().UserGroupXref = userGroupDict;
                }
            } catch (Exception ex) {
                Logger.LogError(8, "Error in UserAdministration.AddUser." + ex.Message);
            } finally {
                SecurityOperations.Finish();
            }

            return(result);
        }
コード例 #2
0
ファイル: MGGroup.cs プロジェクト: DataNirvana/DomainModel
 //-------------------------------------------------------------------------------------------------------------------------------------------------------------
 public MGGroup(MGGroupType _groupType, bool allowDataEdit, bool allowUserEdit)
 {
     name         = _groupType.ToString();
     canEditData  = allowDataEdit;
     canEditUsers = allowUserEdit;
 }
コード例 #3
0
ファイル: MGGroup.cs プロジェクト: DataNirvana/DomainModel
 /// <summary>
 /// Group type is converted to "name"
 /// </summary>
 /// <param name="groupType"></param>
 public MGGroup(MGGroupType _groupType)
 {
     name = _groupType.ToString();
 }