Пример #1
0
        protected override bool GetAgentInfo(UUID scopeID, string fid, out UUID agentID, out string first, out string last)
        {
            first = "Unknown"; last = "UserHGGAI";
            if (base.GetAgentInfo(scopeID, fid, out agentID, out first, out last))
            {
                return(true);
            }

            // fid is not a UUID...
            string url = string.Empty, tmp = string.Empty, f = string.Empty, l = string.Empty;

            if (Util.ParseUniversalUserIdentifier(fid, out agentID, out url, out f, out l, out tmp))
            {
                if (!agentID.Equals(UUID.Zero))
                {
                    m_uMan.AddUser(agentID, f, l, url);

                    string   name  = m_uMan.GetUserName(agentID);
                    string[] parts = name.Trim().Split(new char[] { ' ' });
                    if (parts.Length == 2)
                    {
                        first = parts[0];
                        last  = parts[1];
                    }
                    else
                    {
                        first = f;
                        last  = l;
                    }
                    return(true);
                }
            }
            return(false);
        }
Пример #2
0
        public GroupMembersData ConvertGroupMembersData(ExtendedGroupMembersData _m)
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }


            GroupMembersData m = new GroupMembersData();

            m.AcceptNotices = _m.AcceptNotices;
            m.AgentPowers   = _m.AgentPowers;
            m.Contribution  = _m.Contribution;
            m.IsOwner       = _m.IsOwner;
            m.ListInProfile = _m.ListInProfile;
            m.OnlineStatus  = _m.OnlineStatus;
            m.Title         = _m.Title;

            string url = string.Empty, first = string.Empty, last = string.Empty, tmp = string.Empty;

            Util.ParseUniversalUserIdentifier(_m.AgentID, out m.AgentID, out url, out first, out last, out tmp);
            if (url != string.Empty)
            {
                m_UserManagement.AddUser(m.AgentID, first, last, url);
            }

            return(m);
        }
        public IActionResult Post(UserDetail userDetail)
        {
            if (userDetail == null || string.IsNullOrEmpty(userDetail?.Email))
            {
                return(BadRequest());
            }

            var checkDuplicate = _userManagement.CheckExists(userDetail.Email);

            if (checkDuplicate == null)
            {
                var result = _userManagement.AddUser(userDetail);

                if (result == null)
                {
                    return(StatusCode(StatusCodes.Status500InternalServerError));
                }

                return(Ok(result));
            }
            else
            {
                return(Conflict(checkDuplicate));
            }
        }
Пример #4
0
        //新增使用者
        public string AddUser(string DepNo, string DepName, string UserID, string UserName, string Admin, string PassWord)
        {
            //呼叫IUserManagement介面中的 AddUser方法
            string str = _IUserManagement.AddUser(DepNo, DepName, UserID, UserName, Admin, PassWord);

            return(str);
        }
Пример #5
0
        private UUID ImportForeigner(string uID)
        {
            UUID   userID = UUID.Zero;
            string url = string.Empty, first = string.Empty, last = string.Empty, tmp = string.Empty;

            if (Util.ParseUniversalUserIdentifier(uID, out userID, out url, out first, out last, out tmp))
            {
                m_UserManagement.AddUser(userID, first, last, url);
            }

            return(userID);
        }
Пример #6
0
        public GroupMembersData ConvertGroupMembersData(ExtendedGroupMembersData _m)
        {
            GroupMembersData m = new GroupMembersData();

            m.AcceptNotices = _m.AcceptNotices;
            m.AgentPowers   = _m.AgentPowers;
            m.Contribution  = _m.Contribution;
            m.IsOwner       = _m.IsOwner;
            m.ListInProfile = _m.ListInProfile;
            m.OnlineStatus  = _m.OnlineStatus;
            m.Title         = _m.Title;

            string url = string.Empty, first = string.Empty, last = string.Empty, tmp = string.Empty;

            Util.ParseUniversalUserIdentifier(_m.AgentID, out m.AgentID, out url, out first, out last, out tmp);
            if (url != string.Empty)
            {
                m_UserManagement.AddUser(m.AgentID, first, last, url);
            }

            return(m);
        }
Пример #7
0
        private void 添加toolStripButton1_Click(object sender, EventArgs e)
        {
            if (!CheckControl())
            {
                return;
            }

            //if (!m_personnerServer.AddPersonnelArchive(GetPersonnelArchiveData(), out error))
            //{
            //    MessageDialog.ShowPromptMessage(error);
            //    return;
            //}

            IQueryable <View_Auth_Role> authRole = m_roleManager.GetAllRoles();
            string roleCode = "";

            foreach (var item in authRole)
            {
                if (item.角色名称 == CE_RoleEnum.普通操作员.ToString())
                {
                    roleCode = item.角色编码;
                }
            }

            Auth_User userInfo = new Auth_User();

            userInfo.LoginName          = txtWorkID.Text.Trim();
            userInfo.Password           = "******";
            userInfo.TrueName           = txtName.Text.Trim();
            userInfo.Dept               = m_departmentServer.GetDeptCode(cmbDept.Text);
            userInfo.IsActived          = false;
            userInfo.IsAdmin            = false;
            userInfo.AuthenticationMode = "密码认证";
            userInfo.IsLocked           = false;
            userInfo.CreateDate         = ServerTime.Time;
            userInfo.DestroyFlag        = false;
            userInfo.Remarks            = "通过人员档案自动添加";

            if (m_userManager.AddUser(userInfo))
            {
                if (!m_roleManager.AddUserInRole(roleCode, txtWorkID.Text))
                {
                    MessageDialog.ShowPromptMessage("员工信档案添加成功,角色分配失败!");
                }
            }

            updateFlag = true;
            this.Close();
        }
Пример #8
0
 public override bool LocalFriendshipOffered(UUID toID, GridInstantMessage im)
 {
     if (base.LocalFriendshipOffered(toID, im))
     {
         if (im.fromAgentName.Contains("@"))
         {
             string[] parts = im.fromAgentName.Split(new char[] { '@' });
             if (parts.Length == 2)
             {
                 string[] fl = parts[0].Trim().Split(new char[] { '.' });
                 if (fl.Length == 2)
                 {
                     m_uMan.AddUser(new UUID(im.fromAgentID), fl[0], fl[1], "http://" + parts[1]);
                 }
                 else
                 {
                     m_uMan.AddUser(new UUID(im.fromAgentID), fl[0], "", "http://" + parts[1]);
                 }
             }
         }
         return(true);
     }
     return(false);
 }
        private UUID ImportForeigner(string uID)
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }


            UUID   userID = UUID.Zero;
            string url = string.Empty, first = string.Empty, last = string.Empty, tmp = string.Empty;

            if (Util.ParseUniversalUserIdentifier(uID, out userID, out url, out first, out last, out tmp))
            {
                m_UserManagement.AddUser(userID, first, last, url);
            }

            return(userID);
        }
Пример #10
0
        protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID)
        {
            IInventoryService invService       = m_scene.RequestModuleInterface <IInventoryService> ();
            InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, agentID);

            assetRequestItem = invService.GetItem(assetRequestItem);

            if (assetRequestItem != null &&
                assetRequestItem.CreatorData != null &&
                assetRequestItem.CreatorData != string.Empty)
            {
                IUserManagement userManagement = m_scene.RequestModuleInterface <IUserManagement> ();
                if (userManagement != null)
                {
                    userManagement.AddUser(assetRequestItem.CreatorIdAsUuid, assetRequestItem.CreatorData);
                }
            }
            return(assetRequestItem);
        }
Пример #11
0
        protected override bool CacheFriends(IClientAPI client)
        {
//            m_log.DebugFormat("[HGFRIENDS MODULE]: Entered CacheFriends for {0}", client.Name);

            if (base.CacheFriends(client))
            {
                UUID agentID = client.AgentId;
                // we do this only for the root agent
                if (m_Friends[agentID].Refcount == 1)
                {
                    IUserManagement uMan = m_Scenes[0].RequestModuleInterface <IUserManagement>();
                    if (uMan == null)
                    {
                        return(true);
                    }
                    // We need to preload the user management cache with the names
                    // of foreign friends, just like we do with SOPs' creators
                    foreach (FriendInfo finfo in m_Friends[agentID].Friends)
                    {
                        if (finfo.TheirFlags != -1)
                        {
                            UUID id;
                            if (!UUID.TryParse(finfo.Friend, out id))
                            {
                                string url = string.Empty, first = string.Empty, last = string.Empty, tmp = string.Empty;
                                if (Util.ParseUniversalUserIdentifier(finfo.Friend, out id, out url, out first, out last, out tmp))
                                {
//                                    m_log.DebugFormat("[HGFRIENDS MODULE]: caching {0}", finfo.Friend);
                                    uMan.AddUser(id, first, last, url);
                                }
                            }
                        }
                    }

//                    m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting CacheFriends for {0} since detected root agent", client.Name);
                    return(true);
                }
            }

//            m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting CacheFriends for {0} since detected not root agent", client.Name);
            return(false);
        }
Пример #12
0
        protected override bool GetAgentInfo(UUID scopeID, string fid, out UUID agentID, out string first, out string last)
        {
            first = "Unknown"; last = "User";
            if (base.GetAgentInfo(scopeID, fid, out agentID, out first, out last))
            {
                return(true);
            }

            // fid is not a UUID...
            string url = string.Empty, tmp = string.Empty;

            if (Util.ParseUniversalUserIdentifier(fid, out agentID, out url, out first, out last, out tmp))
            {
                IUserManagement userMan = m_Scenes[0].RequestModuleInterface <IUserManagement>();
                userMan.AddUser(agentID, first, last, url);

                return(true);
            }
            return(false);
        }
Пример #13
0
        public IActionResult Register([FromBody] UserViewModel model)
        {
            var response = ServerResponse.OK;

            response = _requestValidator.ValidateUser(model);
            if (response.RespCode != 200)
            {
                return(Ok(response));
            }
            if (model.UserId == 0)
            {
                bool exist = _requestValidator.UserExists(model.UserName);
                if (exist)
                {
                    return(Ok(_errorMapper.MapToError(ServerResponse.BadRequest, string.Format(Resource.AlreadyExist, "User"))));
                }
            }
            response = _userManagement.AddUser(model);
            return(Ok(response));
        }
Пример #14
0
        public void SendFriendsOnlineIfNeeded(IClientAPI client)
        {
            UUID agentID = client.AgentId;

            // Send outstanding friendship offers
            List <string> outstanding = new List <string>();

            FriendInfo[] friends = GetFriends(agentID);
            foreach (FriendInfo fi in friends)
            {
                if (fi.TheirFlags == -1)
                {
                    outstanding.Add(fi.Friend);
                }
                UUID   friendID;
                string url = "", first = "", last = "", secret = "";
                if (HGUtil.ParseUniversalUserIdentifier(fi.Friend, out friendID, out url, out first, out last,
                                                        out secret))
                {
                    IUserManagement userManagement = m_Scenes[0].RequestModuleInterface <IUserManagement>();
                    if (userManagement != null)
                    {
                        userManagement.AddUser(friendID, fi.Friend);
                    }
                }
            }

            GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, String.Empty, agentID,
                                                           (byte)InstantMessageDialog.FriendshipOffered,
                                                           "Will you be my friend?", true, Vector3.Zero);

            foreach (string fid in outstanding)
            {
                UUID   fromAgentID;
                string url = "", first = "", last = "", secret = "";
                if (!UUID.TryParse(fid, out fromAgentID))
                {
                    if (
                        !HGUtil.ParseUniversalUserIdentifier(fid, out fromAgentID, out url, out first, out last,
                                                             out secret))
                    {
                        continue;
                    }
                }

                UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID,
                                                                                    fromAgentID);

                im.fromAgentID = fromAgentID;
                if (account != null)
                {
                    im.fromAgentName = account.Name;
                }
                else
                {
                    im.fromAgentName = first + " " + last;
                }
                im.offline     = 1;
                im.imSessionID = im.fromAgentID;

                // Finally
                LocalFriendshipOffered(agentID, im);
            }

            lock (m_friendsToInformOfStatusChanges)
            {
                if (m_friendsToInformOfStatusChanges.ContainsKey(agentID))
                {
                    List <UUID> onlineFriends = new List <UUID>(m_friendsToInformOfStatusChanges[agentID]);
                    foreach (UUID friend in onlineFriends)
                    {
                        SendFriendsStatusMessage(agentID, friend, true);
                    }
                    m_friendsToInformOfStatusChanges.Remove(agentID);
                }
            }
        }
Пример #15
0
        private void DearchiveRegion0DotStar()
        {
            int      successfulAssetRestores = 0;
            int      failedAssetRestores     = 0;
            string   filePath = "NONE";
            DateTime start    = DateTime.Now;

            TarArchiveReader archive = new TarArchiveReader(m_loadStream);

            if (!m_skipAssets)
            {
                m_threadpool = new Aurora.Framework.AuroraThreadPool(new Aurora.Framework.AuroraThreadPoolStartInfo()
                {
                    Threads  = 1,
                    priority = System.Threading.ThreadPriority.BelowNormal
                });
            }

            IBackupModule backup = m_scene.RequestModuleInterface <IBackupModule>();

            if (!m_merge)
            {
                DateTime before = DateTime.Now;
                MainConsole.Instance.Info("[ARCHIVER]: Clearing all existing scene objects");
                if (backup != null)
                {
                    backup.DeleteAllSceneObjects();
                }
                MainConsole.Instance.Info("[ARCHIVER]: Cleared all existing scene objects in " + (DateTime.Now - before).Minutes + ":" + (DateTime.Now - before).Seconds);
            }

            IScriptModule[] modules = m_scene.RequestModuleInterfaces <IScriptModule>();
            //Disable the script engine so that it doesn't load in the background and kill OAR loading
            foreach (IScriptModule module in modules)
            {
                module.Disabled = true;
            }
            //Disable backup for now as well
            if (backup != null)
            {
                backup.LoadingPrims = true;
            }

            IRegionSerialiserModule serialiser = m_scene.RequestModuleInterface <IRegionSerialiserModule>();
            int sceneObjectsLoadedCount        = 0;

            //We save the groups so that we can back them up later
            List <SceneObjectGroup> groupsToBackup = new List <SceneObjectGroup>();
            List <LandData>         landData       = new List <LandData>();
            IUserManagement         UserManager    = m_scene.RequestModuleInterface <IUserManagement>();

            // must save off some stuff until after assets have been saved and recieved new uuids
            // keeping these collection local because I am sure they will get large and garbage collection is better that way
            List <byte[]>           seneObjectGroups        = new List <byte[]>();
            Dictionary <UUID, UUID> assetBinaryChangeRecord = new Dictionary <UUID, UUID>();
            Queue <UUID>            assets2Save             = new Queue <UUID>();

            try
            {
                byte[] data;
                TarArchiveReader.TarEntryType entryType;
                while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
                {
                    //MainConsole.Instance.DebugFormat(
                    //    "[ARCHIVER]: Successfully read {0} ({1} bytes)", filePath, data.Length);

                    if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType)
                    {
                        continue;
                    }

                    if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH))
                    {
                        seneObjectGroups.Add(data);
                    }
                    else if (!m_skipAssets && filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
                    {
                        AssetBase asset;
                        if (LoadAsset(filePath, data, out asset))
                        {
                            successfulAssetRestores++;
                            if (m_useAsync)
                            {
                                lock (AssetsToAdd) AssetsToAdd.Add(asset);
                            }
                            else
                            {
                                if (asset.IsBinaryAsset)
                                {
                                    UUID aid = asset.ID;
                                    asset.ID = m_scene.AssetService.Store(asset);
                                    if (asset.ID != aid)
                                    {
                                        assetBinaryChangeRecord.Add(aid, asset.ID);
                                    }
                                }
                                else
                                {
                                    assetNonBinaryCollection.Add(asset.ID, asset);
                                    // I need something I can safely loop through
                                    assets2Save.Enqueue(asset.ID);
                                }
                            }
                        }
                        else
                        {
                            failedAssetRestores++;
                        }

                        if ((successfulAssetRestores + failedAssetRestores) % 250 == 0)
                        {
                            MainConsole.Instance.Info("[ARCHIVER]: Loaded " + successfulAssetRestores + " assets and failed to load " + failedAssetRestores + " assets...");
                        }
                    }
                    else if (filePath.StartsWith(ArchiveConstants.TERRAINS_PATH))
                    {
                        LoadTerrain(filePath, data);
                    }
                    else if (!m_merge && filePath.StartsWith(ArchiveConstants.SETTINGS_PATH))
                    {
                        LoadRegionSettings(filePath, data);
                    }
                    else if (filePath.StartsWith(ArchiveConstants.LANDDATA_PATH))
                    {
                        LandData parcel = LandDataSerializer.Deserialize(m_utf8Encoding.GetString(data));
                        parcel.OwnerID = ResolveUserUuid(parcel.OwnerID, UUID.Zero, "", Vector3.Zero, null);
                        landData.Add(parcel);
                    }
                    else if (filePath == ArchiveConstants.CONTROL_FILE_PATH)
                    {
                        LoadControlFile(data);
                    }
                }
                // Save Assets
                int savingAssetsCount = 0;
                while (assets2Save.Count > 0)
                {
                    try
                    {
                        UUID assetid = assets2Save.Dequeue();
                        SaveNonBinaryAssets(assetid, assetNonBinaryCollection[assetid], assetBinaryChangeRecord);
                        savingAssetsCount++;
                        if ((savingAssetsCount) % 250 == 0)
                        {
                            MainConsole.Instance.Info("[ARCHIVER]: Saving " + savingAssetsCount + " assets...");
                        }
                    }
                    catch (Exception ex)
                    {
                        MainConsole.Instance.Info("[ARCHIVER]: Exception in saving an asset: " + ex.ToString());
                    }
                }

                foreach (byte[] data2 in seneObjectGroups)
                {
                    byte[] data3 = data2;

                    string          stringData = Utils.BytesToString(data3);
                    MatchCollection mc         = Regex.Matches(stringData, sPattern);
                    bool            didChange  = false;
                    if (mc.Count >= 1)
                    {
                        foreach (Match match in mc)
                        {
                            UUID thematch = new UUID(match.Value);
                            UUID newvalue = thematch;
                            if (assetNonBinaryCollection.ContainsKey(thematch))
                            {
                                newvalue = assetNonBinaryCollection[thematch].ID;
                            }
                            else if (assetBinaryChangeRecord.ContainsKey(thematch))
                            {
                                newvalue = assetBinaryChangeRecord[thematch];
                            }
                            if (thematch == newvalue)
                            {
                                continue;
                            }
                            stringData = stringData.Replace(thematch.ToString().Trim(), newvalue.ToString().Trim());
                            didChange  = true;
                        }
                    }
                    if (didChange)
                    {
                        data3 = Utils.StringToBytes(stringData);
                    }

                    SceneObjectGroup sceneObject = (SceneObjectGroup)serialiser.DeserializeGroupFromXml2(data3, m_scene);

                    if (sceneObject == null)
                    {
                        //! big error!
                        MainConsole.Instance.Error("Error reading SOP XML (Please mantis this!): " + m_asciiEncoding.GetString(data3));
                        continue;
                    }

                    foreach (SceneObjectPart part in sceneObject.ChildrenList)
                    {
                        if (string.IsNullOrEmpty(part.CreatorData))
                        {
                            part.CreatorID = ResolveUserUuid(part.CreatorID, part.CreatorID, part.CreatorData, part.AbsolutePosition, landData);
                        }

                        if (UserManager != null)
                        {
                            UserManager.AddUser(part.CreatorID, part.CreatorData);
                        }

                        part.OwnerID = ResolveUserUuid(part.OwnerID, part.CreatorID, part.CreatorData, part.AbsolutePosition, landData);

                        part.LastOwnerID = ResolveUserUuid(part.LastOwnerID, part.CreatorID, part.CreatorData, part.AbsolutePosition, landData);

                        // And zap any troublesome sit target information
                        part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
                        part.SitTargetPosition    = new Vector3(0, 0, 0);

                        // Fix ownership/creator of inventory items
                        // Not doing so results in inventory items
                        // being no copy/no mod for everyone
                        lock (part.TaskInventory)
                        {
                            TaskInventoryDictionary inv = part.TaskInventory;
                            foreach (KeyValuePair <UUID, TaskInventoryItem> kvp in inv)
                            {
                                kvp.Value.OwnerID = ResolveUserUuid(kvp.Value.OwnerID, kvp.Value.CreatorID, kvp.Value.CreatorData, part.AbsolutePosition, landData);
                                if (string.IsNullOrEmpty(kvp.Value.CreatorData))
                                {
                                    kvp.Value.CreatorID = ResolveUserUuid(kvp.Value.CreatorID, kvp.Value.CreatorID, kvp.Value.CreatorData, part.AbsolutePosition, landData);
                                }
                                if (UserManager != null)
                                {
                                    UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData);
                                }
                            }
                        }
                    }

                    //Add the offsets of the region
                    Vector3 newPos = new Vector3(sceneObject.AbsolutePosition.X + m_offsetX,
                                                 sceneObject.AbsolutePosition.Y + m_offsetY,
                                                 sceneObject.AbsolutePosition.Z + m_offsetZ);
                    if (m_flipX)
                    {
                        newPos.X = m_scene.RegionInfo.RegionSizeX - newPos.X;
                    }
                    if (m_flipY)
                    {
                        newPos.Y = m_scene.RegionInfo.RegionSizeY - newPos.Y;
                    }
                    sceneObject.SetAbsolutePosition(false, newPos);

                    if (m_scene.SceneGraph.AddPrimToScene(sceneObject))
                    {
                        groupsToBackup.Add(sceneObject);
                        sceneObject.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate);
                        sceneObjectsLoadedCount++;
                        sceneObject.CreateScriptInstances(0, false, StateSource.RegionStart, UUID.Zero);
                    }
                    sceneObjectsLoadedCount++;
                    if (sceneObjectsLoadedCount % 250 == 0)
                    {
                        MainConsole.Instance.Info("[ARCHIVER]: Loaded " + sceneObjectsLoadedCount + " objects...");
                    }
                }
                assetNonBinaryCollection.Clear();
                assetBinaryChangeRecord.Clear();
                seneObjectGroups.Clear();
            }
            catch (Exception e)
            {
                MainConsole.Instance.ErrorFormat(
                    "[ARCHIVER]: Aborting load with error in archive file {0}.  {1}", filePath, e);
                m_errorMessage += e.ToString();
                m_scene.EventManager.TriggerOarFileLoaded(UUID.Zero.Guid, m_errorMessage);
                return;
            }
            finally
            {
                archive.Close();
                m_loadStream.Close();
                m_loadStream.Dispose();

                //Reeanble now that we are done
                foreach (IScriptModule module in modules)
                {
                    module.Disabled = false;
                }
                //Reset backup too
                if (backup != null)
                {
                    backup.LoadingPrims = false;
                }
            }

            //Now back up the prims
            foreach (SceneObjectGroup grp in groupsToBackup)
            {
                //Backup!
                grp.HasGroupChanged = true;
            }

            if (!m_skipAssets && m_useAsync && !AssetSaverIsRunning)
            {
                m_threadpool.QueueEvent(SaveAssets, 0);
            }

            if (!m_skipAssets)
            {
                MainConsole.Instance.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores);

                if (failedAssetRestores > 0)
                {
                    MainConsole.Instance.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores);
                    m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores);
                }
            }

            // Try to retain the original creator/owner/lastowner if their uuid is present on this grid
            // otherwise, use the master avatar uuid instead

            // Reload serialized parcels
            MainConsole.Instance.InfoFormat("[ARCHIVER]: Loading {0} parcels.  Please wait.", landData.Count);

            IParcelManagementModule parcelManagementModule = m_scene.RequestModuleInterface <IParcelManagementModule>();

            if (!m_merge && parcelManagementModule != null)
            {
                parcelManagementModule.ClearAllParcels();
            }
            if (landData.Count > 0)
            {
                m_scene.EventManager.TriggerIncomingLandDataFromStorage(landData, new Vector2(m_offsetX, m_offsetY));
                //Update the database as well!
                if (parcelManagementModule != null)
                {
                    foreach (LandData parcel in landData)
                    {
                        parcelManagementModule.UpdateLandObject(parcelManagementModule.GetLandObject(parcel.LocalID));
                    }
                }
            }
            else if (parcelManagementModule != null)
            {
                parcelManagementModule.ResetSimLandObjects();
            }

            MainConsole.Instance.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count);

            //Clean it out
            landData.Clear();

            MainConsole.Instance.InfoFormat("[ARCHIVER]: Successfully loaded archive in " + (DateTime.Now - start).Minutes + ":" + (DateTime.Now - start).Seconds);

            m_validUserUuids.Clear();
            m_scene.EventManager.TriggerOarFileLoaded(UUID.Zero.Guid, m_errorMessage);
        }
        private void 添加toolStripButton1_Click(object sender, EventArgs e)
        {
            if (!CheckControl())
            {
                return;
            }

            if (!m_personnerServer.AddPersonnelArchive(GetPersonnelArchiveData(), GetPersonnelListData(), out m_error))
            {
                MessageDialog.ShowPromptMessage(m_error);
                return;
            }

            IQueryable <View_Auth_Role> authRole = m_roleManager.GetAllRoles();
            string roleCode = "";

            foreach (var item in authRole)
            {
                if (item.角色名称 == CE_RoleEnum.普通操作员.ToString())
                {
                    roleCode = item.角色编码;
                }
            }

            Auth_User userInfo = new Auth_User();

            userInfo.LoginName          = txtWorkID.Text.Trim();
            userInfo.Password           = "******";
            userInfo.TrueName           = txtName.Text.Trim();
            userInfo.Dept               = m_departmentServer.GetDeptCode(cmbDept.Text);
            userInfo.IsActived          = false;
            userInfo.IsAdmin            = false;
            userInfo.AuthenticationMode = "密码认证";
            userInfo.IsLocked           = false;
            userInfo.CreateDate         = ServerTime.Time;
            userInfo.DestroyFlag        = false;
            userInfo.Remarks            = "通过人员档案自动添加";
            userInfo.Handset            = txtMobilePhone.Text.Trim();

            if (m_userManager.AddUser(userInfo))
            {
                if (!m_roleManager.AddUserInRole(roleCode, txtWorkID.Text))
                {
                    MessageDialog.ShowPromptMessage("员工信档案添加成功,角色分配失败!");
                }

                Flow_WarningNotice warning = new Flow_WarningNotice();

                warning.标题    = "合同等待新签";
                warning.发送方   = "系统";
                warning.发送时间  = ServerTime.Time;
                warning.附加信息1 = "员工合同管理";
                warning.附加信息2 = txtWorkID.Text;
                warning.附加信息3 = "0";
                warning.附加信息4 = "";
                warning.附加信息5 = "";
                warning.附加信息6 = "";
                warning.附加信息7 = "";
                warning.附加信息8 = "";
                warning.接收方   = "人力资源部办公室文员";
                warning.接收方类型 = "角色";
                warning.来源    = "人力资源管理系统";
                warning.内容    = "【" + txtName.Text + "】员工【合同类】等待新签!";
                warning.优先级   = "高";
                warning.状态    = "未读";

                m_warningNotice.SendWarningNotice(warning);
            }

            m_updateFlag = true;
            this.Close();
        }
Пример #17
0
 public async Task Post([FromBody] User user)
 {
     await _userManagement.AddUser(user.DisplayName, user.Username, user.Password);
 }
Пример #18
0
        private void DearchiveRegion0DotStar()
        {
            int      successfulAssetRestores = 0;
            int      failedAssetRestores     = 0;
            string   filePath = "NONE";
            DateTime start    = DateTime.Now;

            TarArchiveReader archive = new TarArchiveReader(m_loadStream);

            byte[] data;
            TarArchiveReader.TarEntryType entryType;

            if (!m_skipAssets)
            {
                m_threadpool = new Aurora.Framework.AuroraThreadPool(new Aurora.Framework.AuroraThreadPoolStartInfo()
                {
                    Threads  = 1,
                    priority = System.Threading.ThreadPriority.BelowNormal
                });
            }

            IBackupModule backup = m_scene.RequestModuleInterface <IBackupModule>();

            if (!m_merge)
            {
                DateTime before = DateTime.Now;
                MainConsole.Instance.Info("[ARCHIVER]: Clearing all existing scene objects");
                if (backup != null)
                {
                    backup.DeleteAllSceneObjects();
                }
                MainConsole.Instance.Info("[ARCHIVER]: Cleared all existing scene objects in " + (DateTime.Now - before).Minutes + ":" + (DateTime.Now - before).Seconds);
            }

            IScriptModule[] modules = m_scene.RequestModuleInterfaces <IScriptModule>();
            //Disable the script engine so that it doesn't load in the background and kill OAR loading
            foreach (IScriptModule module in modules)
            {
                module.Disabled = true;
            }
            //Disable backup for now as well
            if (backup != null)
            {
                backup.LoadingPrims = true;
            }

            IRegionSerialiserModule serialiser = m_scene.RequestModuleInterface <IRegionSerialiserModule>();
            int sceneObjectsLoadedCount        = 0;

            //We save the groups so that we can back them up later
            List <SceneObjectGroup> groupsToBackup = new List <SceneObjectGroup>();
            List <LandData>         landData       = new List <LandData>();
            IUserManagement         UserManager    = m_scene.RequestModuleInterface <IUserManagement>();

            try
            {
                while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
                {
                    //MainConsole.Instance.DebugFormat(
                    //    "[ARCHIVER]: Successfully read {0} ({1} bytes)", filePath, data.Length);

                    if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType)
                    {
                        continue;
                    }

                    if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH))
                    {
                        /*
                         * MainConsole.Instance.DebugFormat("[ARCHIVER]: Loading xml with raw size {0}", serialisedSceneObject.Length);
                         *
                         * // Really large xml files (multi megabyte) appear to cause
                         * // memory problems
                         * // when loading the xml.  But don't enable this check yet
                         *
                         * if (serialisedSceneObject.Length > 5000000)
                         * {
                         *  MainConsole.Instance.Error("[ARCHIVER]: Ignoring xml since size > 5000000);");
                         *  continue;
                         * }
                         */

                        SceneObjectGroup sceneObject = (SceneObjectGroup)serialiser.DeserializeGroupFromXml2(data, m_scene);

                        if (sceneObject == null)
                        {
                            //! big error!
                            MainConsole.Instance.Error("Error reading SOP XML (Please mantis this!): " + m_asciiEncoding.GetString(data));
                            continue;
                        }

                        foreach (SceneObjectPart part in sceneObject.ChildrenList)
                        {
                            if (part.CreatorData == null || part.CreatorData == string.Empty)
                            {
                                part.CreatorID = ResolveUserUuid(part.CreatorID, part.CreatorID, part.CreatorData, part.AbsolutePosition, landData);
                            }

                            if (UserManager != null)
                            {
                                UserManager.AddUser(part.CreatorID, part.CreatorData);
                            }

                            part.OwnerID = ResolveUserUuid(part.OwnerID, part.CreatorID, part.CreatorData, part.AbsolutePosition, landData);

                            part.LastOwnerID = ResolveUserUuid(part.LastOwnerID, part.CreatorID, part.CreatorData, part.AbsolutePosition, landData);

                            // And zap any troublesome sit target information
                            part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
                            part.SitTargetPosition    = new Vector3(0, 0, 0);

                            // Fix ownership/creator of inventory items
                            // Not doing so results in inventory items
                            // being no copy/no mod for everyone
                            lock (part.TaskInventory)
                            {
                                TaskInventoryDictionary inv = part.TaskInventory;
                                foreach (KeyValuePair <UUID, TaskInventoryItem> kvp in inv)
                                {
                                    kvp.Value.OwnerID = ResolveUserUuid(kvp.Value.OwnerID, kvp.Value.CreatorID, kvp.Value.CreatorData, part.AbsolutePosition, landData);
                                    if (kvp.Value.CreatorData == null || kvp.Value.CreatorData == string.Empty)
                                    {
                                        kvp.Value.CreatorID = ResolveUserUuid(kvp.Value.CreatorID, kvp.Value.CreatorID, kvp.Value.CreatorData, part.AbsolutePosition, landData);
                                    }
                                    if (UserManager != null)
                                    {
                                        UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData);
                                    }
                                }
                            }
                        }

                        //Add the offsets of the region
                        Vector3 newPos = new Vector3(sceneObject.AbsolutePosition.X + m_offsetX,
                                                     sceneObject.AbsolutePosition.Y + m_offsetY,
                                                     sceneObject.AbsolutePosition.Z + m_offsetZ);
                        if (m_flipX)
                        {
                            newPos.X = m_scene.RegionInfo.RegionSizeX - newPos.X;
                        }
                        if (m_flipY)
                        {
                            newPos.Y = m_scene.RegionInfo.RegionSizeY - newPos.Y;
                        }
                        sceneObject.SetAbsolutePosition(false, newPos);

                        if (m_scene.SceneGraph.AddPrimToScene(sceneObject))
                        {
                            groupsToBackup.Add(sceneObject);
                            sceneObject.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate);
                            sceneObjectsLoadedCount++;
                            sceneObject.CreateScriptInstances(0, false, StateSource.RegionStart, UUID.Zero);
                        }
                        sceneObjectsLoadedCount++;
                        if (sceneObjectsLoadedCount % 250 == 0)
                        {
                            MainConsole.Instance.Info("[ARCHIVER]: Loaded " + sceneObjectsLoadedCount + " objects...");
                        }
                    }
                    else if (!m_skipAssets && filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
                    {
                        if (LoadAsset(filePath, data))
                        {
                            successfulAssetRestores++;
                        }
                        else
                        {
                            failedAssetRestores++;
                        }

                        if ((successfulAssetRestores + failedAssetRestores) % 250 == 0)
                        {
                            MainConsole.Instance.Info("[ARCHIVER]: Loaded " + successfulAssetRestores + " assets and failed to load " + failedAssetRestores + " assets...");
                        }
                    }
                    else if (filePath.StartsWith(ArchiveConstants.TERRAINS_PATH))
                    {
                        LoadTerrain(filePath, data);
                    }
                    else if (!m_merge && filePath.StartsWith(ArchiveConstants.SETTINGS_PATH))
                    {
                        LoadRegionSettings(filePath, data);
                    }
                    else if (filePath.StartsWith(ArchiveConstants.LANDDATA_PATH))
                    {
                        LandData parcel = LandDataSerializer.Deserialize(m_utf8Encoding.GetString(data));
                        parcel.OwnerID = ResolveUserUuid(parcel.OwnerID, UUID.Zero, "", Vector3.Zero, null);
                        landData.Add(parcel);
                    }
                    else if (filePath == ArchiveConstants.CONTROL_FILE_PATH)
                    {
                        LoadControlFile(filePath, data);
                    }
                }

                //MainConsole.Instance.Debug("[ARCHIVER]: Reached end of archive");
            }
            catch (Exception e)
            {
                MainConsole.Instance.ErrorFormat(
                    "[ARCHIVER]: Aborting load with error in archive file {0}.  {1}", filePath, e);
                m_errorMessage += e.ToString();
                m_scene.EventManager.TriggerOarFileLoaded(UUID.Zero.Guid, m_errorMessage);
                return;
            }
            finally
            {
                archive.Close();
                m_loadStream.Close();
                m_loadStream.Dispose();

                //Reeanble now that we are done
                foreach (IScriptModule module in modules)
                {
                    module.Disabled = false;
                }
                //Reset backup too
                if (backup != null)
                {
                    backup.LoadingPrims = false;
                }
            }

            //Now back up the prims
            foreach (SceneObjectGroup grp in groupsToBackup)
            {
                //Backup!
                grp.HasGroupChanged = true;
            }

            if (!m_skipAssets && m_useAsync && !AssetSaverIsRunning)
            {
                m_threadpool.QueueEvent(SaveAssets, 0);
            }

            if (!m_skipAssets)
            {
                MainConsole.Instance.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores);

                if (failedAssetRestores > 0)
                {
                    MainConsole.Instance.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores);
                    m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores);
                }
            }

            // Try to retain the original creator/owner/lastowner if their uuid is present on this grid
            // otherwise, use the master avatar uuid instead

            // Reload serialized parcels
            MainConsole.Instance.InfoFormat("[ARCHIVER]: Loading {0} parcels.  Please wait.", landData.Count);

            IParcelManagementModule parcelManagementModule = m_scene.RequestModuleInterface <IParcelManagementModule>();

            if (!m_merge && parcelManagementModule != null)
            {
                parcelManagementModule.ClearAllParcels();
            }
            if (landData.Count > 0)
            {
                m_scene.EventManager.TriggerIncomingLandDataFromStorage(landData, new Vector2(m_offsetX, m_offsetY));
                //Update the database as well!
                if (parcelManagementModule != null)
                {
                    foreach (LandData parcel in landData)
                    {
                        parcelManagementModule.UpdateLandObject(parcelManagementModule.GetLandObject(parcel.LocalID));
                    }
                }
            }
            else if (parcelManagementModule != null)
            {
                parcelManagementModule.ResetSimLandObjects();
            }

            MainConsole.Instance.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count);

            //Clean it out
            landData.Clear();

            MainConsole.Instance.InfoFormat("[ARCHIVER]: Successfully loaded archive in " + (DateTime.Now - start).Minutes + ":" + (DateTime.Now - start).Seconds);

            m_validUserUuids.Clear();
            m_scene.EventManager.TriggerOarFileLoaded(UUID.Zero.Guid, m_errorMessage);
        }