add a grid services god account

httptests
UbitUmarov 2017-05-11 17:15:02 +01:00
parent 731510c305
commit 7e8c996d1b
1 changed files with 52 additions and 26 deletions

View File

@ -43,6 +43,7 @@ namespace OpenSim.Services.UserAccountService
public class UserAccountService : UserAccountServiceBase, IUserAccountService public class UserAccountService : UserAccountServiceBase, IUserAccountService
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly UUID UUID_GRID_GOD = new UUID("6571e388-6218-4574-87db-f9379718315e");
private static UserAccountService m_RootInstance; private static UserAccountService m_RootInstance;
/// <summary> /// <summary>
@ -85,11 +86,35 @@ namespace OpenSim.Services.UserAccountService
m_CreateDefaultAvatarEntries = userConfig.GetBoolean("CreateDefaultAvatarEntries", false); m_CreateDefaultAvatarEntries = userConfig.GetBoolean("CreateDefaultAvatarEntries", false);
// In case there are several instances of this class in the same process, // create a system grid god account
// the console commands are only registered for the root instance UserAccount ggod = GetUserAccount(UUID.Zero, UUID_GRID_GOD);
if (m_RootInstance == null && MainConsole.Instance != null) if(ggod == null)
{
UserAccountData d = new UserAccountData();
d.FirstName = "GRID";
d.LastName = "SERVICES";
d.PrincipalID = UUID_GRID_GOD;
d.ScopeID = UUID.Zero;
d.Data = new Dictionary<string, string>();
d.Data["Email"] = string.Empty;
d.Data["Created"] = Util.UnixTimeSinceEpoch().ToString();
d.Data["UserLevel"] = "240";
d.Data["UserFlags"] = "0";
d.Data["ServiceURLs"] = string.Empty;
m_Database.Store(d);
}
if (m_RootInstance == null)
{ {
m_RootInstance = this; m_RootInstance = this;
// In case there are several instances of this class in the same process,
// the console commands are only registered for the root instance
if (MainConsole.Instance != null)
{
MainConsole.Instance.Commands.AddCommand("Users", false, MainConsole.Instance.Commands.AddCommand("Users", false,
"create user", "create user",
"create user [<first> [<last> [<pass> [<email> [<user id> [<model>]]]]]]", "create user [<first> [<last> [<pass> [<email> [<user id> [<model>]]]]]]",
@ -119,6 +144,7 @@ namespace OpenSim.Services.UserAccountService
"Show account details for the given user", HandleShowAccount); "Show account details for the given user", HandleShowAccount);
} }
} }
}
#region IUserAccountService #region IUserAccountService