private void CreateLibrary(string libraryOwnerName) { // User creation if (m_userClient != null) { User libraryUser; if (!m_userClient.TryGetUser(LIBRARY_OWNER, out libraryUser)) { // Create the library owner libraryUser = new User { AccessLevel = 1, Email = "INVALID " + UUID.Random().ToString(), ID = LIBRARY_OWNER, LastLogin = DateTime.UtcNow, Name = libraryOwnerName }; if (!m_userClient.CreateUser(libraryUser)) { m_log.ErrorFormat("Failed to create library owner \"{0}\" ({1})", libraryOwnerName, LIBRARY_OWNER); } } } // Inventory creation Dictionary <UUID, InventoryBase> library = new Dictionary <UUID, InventoryBase>(); UUID libraryRoot = CreateFolder(library, UUID.Zero, "Library", "application/vnd.ll.folder", LIBRARY_OWNER); UUID clothingFolder = CreateFolder(library, libraryRoot, "Clothing", "application/vnd.ll.clothing", LIBRARY_OWNER); m_inventory[LIBRARY_OWNER] = library; m_log.InfoFormat("Created library owned by \"{0}\" ({1})", libraryOwnerName, LIBRARY_OWNER); }
private UserSession AnonymousLogin(string name, byte accessLevel, OSDMap extraData, string identifier, string type, string credential) { User user; if (!m_userClient.TryAuthorizeIdentity(identifier, type, credential, out user)) { // We don't have an e-mail address for this person so just create a random string for the e-mail string email = "INVALID " + UUID.Random().ToString(); // Create a new user and identity m_userClient.CreateUser(name, email, accessLevel, extraData, out user); m_userClient.CreateIdentity(new Identity { UserID = user.ID, Enabled = true, Credential = credential, Identifier = identifier, Type = type }); } // Create a session for this user UserSession session = new UserSession(user); session.SessionID = UUID.Random(); session.SecureSessionID = UUID.Random(); session.SetField("CircuitCode", OSD.FromInteger(m_circuitCodeGenerator.Next())); user.LastLogin = DateTime.UtcNow; // Store the session in the user service m_userClient.AddSession(session); return(session); }
/// <summary> /// Create the user /// </summary> /// <param name="User">User Model</param> /// <returns>unique indetifier for the created user</returns> public async Task <long> CreateUser(UserCreate User) { return(await _userClient.CreateUser(User)); }