* Made UserAccountService handle UserLevel, UserFlags and UserTitle appropriately.

* Removed Store service from the UserAccount handler.
slimupdates
Diva Canto 2010-04-03 12:03:34 -07:00
parent 35c82a31db
commit 6485c576a1
4 changed files with 114 additions and 118 deletions

View File

@ -601,14 +601,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
public List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID) public List<GroupMembersData> GroupMembersRequest(IClientAPI remoteClient, UUID groupID)
{ {
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
List<GroupMembersData> data = m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), groupID); List<GroupMembersData> data = m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), groupID);
if (m_debugEnabled) if (m_debugEnabled)
{ {
foreach (GroupMembersData member in data) foreach (GroupMembersData member in data)
{ {
m_log.DebugFormat("[GROUPS]: Member({0}) - IsOwner({1})", member.AgentID, member.IsOwner); m_log.DebugFormat("[GROUPS]: Member({0}) - IsOwner({1})", member.AgentID, member.IsOwner);
} }
} }
return data; return data;
@ -628,14 +628,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
{ {
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
List<GroupRoleMembersData> data = m_groupData.GetGroupRoleMembers(GetRequestingAgentID(remoteClient), groupID); List<GroupRoleMembersData> data = m_groupData.GetGroupRoleMembers(GetRequestingAgentID(remoteClient), groupID);
if (m_debugEnabled) if (m_debugEnabled)
{ {
foreach (GroupRoleMembersData member in data) foreach (GroupRoleMembersData member in data)
{ {
m_log.DebugFormat("[GROUPS]: Member({0}) - Role({1})", member.MemberID, member.RoleID); m_log.DebugFormat("[GROUPS]: Member({0}) - Role({1})", member.MemberID, member.RoleID);
} }
} }
return data; return data;
} }
@ -1144,11 +1144,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
OSDMap llDataStruct = new OSDMap(3); OSDMap llDataStruct = new OSDMap(3);
llDataStruct.Add("AgentData", AgentData); llDataStruct.Add("AgentData", AgentData);
llDataStruct.Add("GroupData", GroupData); llDataStruct.Add("GroupData", GroupData);
llDataStruct.Add("NewGroupData", NewGroupData); llDataStruct.Add("NewGroupData", NewGroupData);
if (m_debugEnabled) if (m_debugEnabled)
{ {
m_log.InfoFormat("[GROUPS]: {0}", OSDParser.SerializeJsonString(llDataStruct)); m_log.InfoFormat("[GROUPS]: {0}", OSDParser.SerializeJsonString(llDataStruct));
} }
IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>(); IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
@ -1308,16 +1308,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
// //
} }
#endregion #endregion
private UUID GetRequestingAgentID(IClientAPI client) private UUID GetRequestingAgentID(IClientAPI client)
{ {
UUID requestingAgentID = UUID.Zero; UUID requestingAgentID = UUID.Zero;
if (client != null) if (client != null)
{ {
requestingAgentID = client.AgentId; requestingAgentID = client.AgentId;
} }
return requestingAgentID; return requestingAgentID;
} }
} }

View File

@ -288,8 +288,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
if(SimianAddGeneric(GroupID, "Group", name, GroupInfoMap)) if(SimianAddGeneric(GroupID, "Group", name, GroupInfoMap))
{ {
AddGroupRole(requestingAgentID, GroupID, UUID.Zero, "Everyone", "Members of " + name, "Member of " + name, (ulong)m_DefaultEveryonePowers); AddGroupRole(requestingAgentID, GroupID, UUID.Zero, "Everyone", "Members of " + name, "Member of " + name, (ulong)m_DefaultEveryonePowers);
AddGroupRole(requestingAgentID, GroupID, OwnerRoleID, "Owners", "Owners of " + name, "Owner of " + name, (ulong)m_DefaultOwnerPowers); AddGroupRole(requestingAgentID, GroupID, OwnerRoleID, "Owners", "Owners of " + name, "Owner of " + name, (ulong)m_DefaultOwnerPowers);
AddAgentToGroup(requestingAgentID, requestingAgentID, GroupID, OwnerRoleID); AddAgentToGroup(requestingAgentID, requestingAgentID, GroupID, OwnerRoleID);
@ -413,7 +413,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
} }
} }
else if ((groupName != null) && (groupName != string.Empty)) else if ((groupName != null) && (groupName != string.Empty))
{ {
if (!SimianGetFirstGenericEntry("Group", groupName, out groupID, out GroupInfoMap)) if (!SimianGetFirstGenericEntry("Group", groupName, out groupID, out GroupInfoMap))
{ {
return null; return null;
@ -422,7 +422,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
GroupRecord GroupInfo = new GroupRecord(); GroupRecord GroupInfo = new GroupRecord();
GroupInfo.GroupID = groupID; GroupInfo.GroupID = groupID;
GroupInfo.GroupName = groupName; GroupInfo.GroupName = groupName;
GroupInfo.Charter = GroupInfoMap["Charter"].AsString(); GroupInfo.Charter = GroupInfoMap["Charter"].AsString();
GroupInfo.ShowInList = GroupInfoMap["ShowInList"].AsBoolean(); GroupInfo.ShowInList = GroupInfoMap["ShowInList"].AsBoolean();
@ -751,9 +751,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
if (SimianGetGenericEntry(agentID, "Group", "ActiveGroup", out UserActiveGroup)) if (SimianGetGenericEntry(agentID, "Group", "ActiveGroup", out UserActiveGroup))
{ {
GroupID = UserActiveGroup["GroupID"].AsUUID(); GroupID = UserActiveGroup["GroupID"].AsUUID();
} }
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Active GroupID : {0}", GroupID.ToString()); if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Active GroupID : {0}", GroupID.ToString());
return GetAgentGroupMembership(requestingAgentID, agentID, GroupID); return GetAgentGroupMembership(requestingAgentID, agentID, GroupID);
} }
@ -781,24 +781,24 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
List<GroupRolesData> Roles = new List<GroupRolesData>(); List<GroupRolesData> Roles = new List<GroupRolesData>();
Dictionary<string, OSDMap> GroupRoles; Dictionary<string, OSDMap> GroupRoles;
if (SimianGetGenericEntries(groupID, "GroupRole", out GroupRoles)) if (SimianGetGenericEntries(groupID, "GroupRole", out GroupRoles))
{ {
Dictionary<string, OSDMap> MemberRoles; Dictionary<string, OSDMap> MemberRoles;
if (SimianGetGenericEntries(agentID, "GroupRole" + groupID.ToString(), out MemberRoles)) if (SimianGetGenericEntries(agentID, "GroupRole" + groupID.ToString(), out MemberRoles))
{ {
foreach (KeyValuePair<string, OSDMap> kvp in MemberRoles) foreach (KeyValuePair<string, OSDMap> kvp in MemberRoles)
{ {
GroupRolesData data = new GroupRolesData(); GroupRolesData data = new GroupRolesData();
data.RoleID = UUID.Parse(kvp.Key); data.RoleID = UUID.Parse(kvp.Key);
data.Name = GroupRoles[kvp.Key]["Name"].AsString(); data.Name = GroupRoles[kvp.Key]["Name"].AsString();
data.Description = GroupRoles[kvp.Key]["Description"].AsString(); data.Description = GroupRoles[kvp.Key]["Description"].AsString();
data.Title = GroupRoles[kvp.Key]["Title"].AsString(); data.Title = GroupRoles[kvp.Key]["Title"].AsString();
data.Powers = GroupRoles[kvp.Key]["Powers"].AsULong(); data.Powers = GroupRoles[kvp.Key]["Powers"].AsULong();
Roles.Add(data); Roles.Add(data);
} }
} }
} }
return Roles; return Roles;
} }
@ -912,8 +912,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
{ {
foreach( KeyValuePair<UUID, OSDMap> GroupRoleMember in GroupRoleMembers ) foreach( KeyValuePair<UUID, OSDMap> GroupRoleMember in GroupRoleMembers )
{ {
GroupRoleMembersData data = new GroupRoleMembersData(); GroupRoleMembersData data = new GroupRoleMembersData();
data.MemberID = GroupRoleMember.Key; data.MemberID = GroupRoleMember.Key;
data.RoleID = UUID.Parse(Role.Key); data.RoleID = UUID.Parse(Role.Key);
@ -1066,20 +1066,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
OSDMap Response = WebUtil.PostToService(m_serviceURL, RequestArgs); OSDMap Response = WebUtil.PostToService(m_serviceURL, RequestArgs);
if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray) if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray)
{ {
OSDArray entryArray = (OSDArray)Response["Entries"]; OSDArray entryArray = (OSDArray)Response["Entries"];
if (entryArray.Count >= 1) if (entryArray.Count >= 1)
{ {
OSDMap entryMap = entryArray[0] as OSDMap; OSDMap entryMap = entryArray[0] as OSDMap;
key = entryMap["Key"].AsString(); key = entryMap["Key"].AsString();
map = (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()); map = (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString());
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString());
return true; return true;
} }
else else
{ {
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
} }
} }
else else
@ -1106,20 +1106,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
OSDMap Response = WebUtil.PostToService(m_serviceURL, RequestArgs); OSDMap Response = WebUtil.PostToService(m_serviceURL, RequestArgs);
if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray) if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray)
{ {
OSDArray entryArray = (OSDArray)Response["Entries"]; OSDArray entryArray = (OSDArray)Response["Entries"];
if (entryArray.Count >= 1) if (entryArray.Count >= 1)
{ {
OSDMap entryMap = entryArray[0] as OSDMap; OSDMap entryMap = entryArray[0] as OSDMap;
ownerID = entryMap["OwnerID"].AsUUID(); ownerID = entryMap["OwnerID"].AsUUID();
map = (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()); map = (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString());
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString());
return true; return true;
} }
else else
{ {
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
} }
} }
else else
@ -1152,16 +1152,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
{ {
OSDMap entryMap = entryArray[0] as OSDMap; OSDMap entryMap = entryArray[0] as OSDMap;
key = entryMap["Key"].AsString(); key = entryMap["Key"].AsString();
map = (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()); map = (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString());
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString());
return true; return true;
} }
else else
{ {
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
} }
} }
else else
{ {
@ -1191,13 +1191,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
OSDArray entryArray = (OSDArray)response["Entries"]; OSDArray entryArray = (OSDArray)response["Entries"];
foreach (OSDMap entryMap in entryArray) foreach (OSDMap entryMap in entryArray)
{ {
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString());
maps.Add(entryMap["Key"].AsString(), (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString())); maps.Add(entryMap["Key"].AsString(), (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()));
} }
if(maps.Count == 0) if(maps.Count == 0)
{ {
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
} }
return true; return true;
@ -1229,14 +1229,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
OSDArray entryArray = (OSDArray)response["Entries"]; OSDArray entryArray = (OSDArray)response["Entries"];
foreach (OSDMap entryMap in entryArray) foreach (OSDMap entryMap in entryArray)
{ {
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString());
maps.Add(entryMap["OwnerID"].AsUUID(), (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString())); maps.Add(entryMap["OwnerID"].AsUUID(), (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()));
} }
if (maps.Count == 0) if (maps.Count == 0)
{ {
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
} }
return true; return true;
} }
else else

View File

@ -176,18 +176,7 @@ namespace OpenSim.Server.Handlers.UserAccounts
byte[] StoreAccount(Dictionary<string, object> request) byte[] StoreAccount(Dictionary<string, object> request)
{ {
//if (!request.ContainsKey("account")) // No can do. No changing user accounts from remote sims
// return FailureResult();
//if (request["account"] == null)
// return FailureResult();
//if (!(request["account"] is Dictionary<string, object>))
// return FailureResult();
UserAccount account = new UserAccount(request);
if (m_UserAccountService.StoreUserAccount(account))
return SuccessResult();
return FailureResult(); return FailureResult();
} }

View File

@ -134,6 +134,10 @@ namespace OpenSim.Services.UserAccountService
u.UserTitle = d.Data["UserTitle"].ToString(); u.UserTitle = d.Data["UserTitle"].ToString();
else else
u.UserTitle = string.Empty; u.UserTitle = string.Empty;
if (d.Data.ContainsKey("UserLevel") && d.Data["UserLevel"] != null)
Int32.TryParse(d.Data["UserLevel"], out u.UserLevel);
if (d.Data.ContainsKey("UserFlags") && d.Data["UserFlags"] != null)
Int32.TryParse(d.Data["UserFlags"], out u.UserFlags);
if (d.Data.ContainsKey("ServiceURLs") && d.Data["ServiceURLs"] != null) if (d.Data.ContainsKey("ServiceURLs") && d.Data["ServiceURLs"] != null)
{ {
@ -218,6 +222,9 @@ namespace OpenSim.Services.UserAccountService
d.Data = new Dictionary<string, string>(); d.Data = new Dictionary<string, string>();
d.Data["Email"] = data.Email; d.Data["Email"] = data.Email;
d.Data["Created"] = data.Created.ToString(); d.Data["Created"] = data.Created.ToString();
d.Data["UserLevel"] = data.UserLevel.ToString();
d.Data["UserFlags"] = data.UserFlags.ToString();
d.Data["UserTitle"] = data.UserTitle.ToString();
List<string> parts = new List<string>(); List<string> parts = new List<string>();