public static GroupRolesData GroupRolesData(Dictionary<string, object> dict) { GroupRolesData role = new GroupRolesData(); if (dict == null) return role; if (dict.ContainsKey("Description") && dict["Description"] != null) role.Description = Sanitize(dict["Description"].ToString()); else role.Description = string.Empty; if (dict.ContainsKey("Members") && dict["Members"] != null) role.Members = Int32.Parse(dict["Members"].ToString()); if (dict.ContainsKey("Name") && dict["Name"] != null) role.Name = Sanitize(dict["Name"].ToString()); else role.Name = string.Empty; if (dict.ContainsKey("Powers") && dict["Powers"] != null) role.Powers = UInt64.Parse(dict["Powers"].ToString()); if (dict.ContainsKey("Title") && dict["Title"] != null) role.Title = Sanitize(dict["Title"].ToString()); else role.Title = string.Empty; if (dict.ContainsKey("RoleID") && dict["RoleID"] != null) role.RoleID = UUID.Parse(dict["RoleID"].ToString()); return role; }
public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID GroupID) { Hashtable param = new Hashtable(); param["GroupID"] = GroupID.ToString(); Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupRoles", param); List<GroupRolesData> Roles = new List<GroupRolesData>(); if (respData.Contains("error")) { return Roles; } foreach (Hashtable role in respData.Values) { GroupRolesData data = new GroupRolesData(); data.Description = (string)role["Description"]; data.Members = int.Parse((string)role["Members"]); data.Name = (string)role["Name"]; data.Powers = ulong.Parse((string)role["Powers"]); data.RoleID = new UUID((string)role["RoleID"]); data.Title = (string)role["Title"]; Roles.Add(data); } return Roles; }
public bool AddGroupRole(UUID groupID, UUID roleID, string description, string name, ulong powers, string title, BooleanDelegate d) { if (d()) { GroupRolesData role = new GroupRolesData(); role.Description = description; role.Members = 0; role.Name = name; role.Powers = powers; role.RoleID = roleID; role.Title = title; lock (m_Cache) { m_Cache.AddOrUpdate("role-" + roleID.ToString(), role, GROUPS_CACHE_TIMEOUT); // also remove this list if (m_Cache.Contains("roles-" + groupID.ToString())) m_Cache.Remove("roles-" + groupID.ToString()); } return true; } return false; }
public static Dictionary<string, object> GroupRolesData(GroupRolesData role) { Dictionary<string, object> dict = new Dictionary<string, object>(); dict["Description"] = Sanitize(role.Description); dict["Members"] = role.Members.ToString(); dict["Name"] = Sanitize(role.Name); dict["Powers"] = role.Powers.ToString(); dict["RoleID"] = role.RoleID.ToString(); dict["Title"] = Sanitize(role.Title); return dict; }
protected List<GroupRolesData> _GetGroupRoles(UUID groupID) { List<GroupRolesData> roles = new List<GroupRolesData>(); RoleData[] data = m_Database.RetrieveRoles(groupID); if (data == null || (data != null && data.Length == 0)) return roles; foreach (RoleData d in data) { GroupRolesData r = new GroupRolesData(); r.Description = d.Data["Description"]; r.Members = m_Database.RoleMemberCount(groupID, d.RoleID); r.Name = d.Data["Name"]; r.Powers = UInt64.Parse(d.Data["Powers"]); r.RoleID = d.RoleID; r.Title = d.Data["Title"]; roles.Add(r); } return roles; }
public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID groupID) { if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); List<GroupRolesData> Roles = new List<GroupRolesData>(); Dictionary<string, OSDMap> GroupRoles; if (SimianGetGenericEntries(groupID, "GroupRole", out GroupRoles)) { foreach (KeyValuePair<string, OSDMap> role in GroupRoles) { GroupRolesData data = new GroupRolesData(); data.RoleID = UUID.Parse(role.Key); data.Name = role.Value["Name"].AsString(); data.Description = role.Value["Description"].AsString(); data.Title = role.Value["Title"].AsString(); data.Powers = role.Value["Powers"].AsULong(); Dictionary<UUID, OSDMap> GroupRoleMembers; if (SimianGetGenericEntries("GroupRole" + groupID.ToString(), role.Key, out GroupRoleMembers)) { data.Members = GroupRoleMembers.Count; } else { data.Members = 0; } Roles.Add(data); } } return Roles; }
public List<GroupRolesData> GetAgentGroupRoles(string RequestingAgentID, string AgentID, UUID GroupID) { List<GroupRolesData> roles = new List<GroupRolesData>(); // TODO: check permissions RoleMembershipData[] data = m_Database.RetrieveMemberRoles(GroupID, AgentID); if (data == null || (data != null && data.Length ==0)) return roles; foreach (RoleMembershipData d in data) { RoleData rdata = m_Database.RetrieveRole(GroupID, d.RoleID); if (rdata == null) // hippos continue; GroupRolesData r = new GroupRolesData(); r.Name = rdata.Data["Name"]; r.Powers = UInt64.Parse(rdata.Data["Powers"]); r.RoleID = rdata.RoleID; r.Title = rdata.Data["Title"]; roles.Add(r); } return roles; }
private OpenSim.Framework.GroupRolesData MapGroupRolesDataFromResult(Dictionary<string, string> result) { //osrole.RoleID, osrole.Name, osrole.Title, osrole.Description, osrole.Powers, " + //count(osgrouprolemembership.AgentID) as Members OpenSim.Framework.GroupRolesData rolesData = new OpenSim.Framework.GroupRolesData(); rolesData.RoleID = new UUID(result["RoleID"]); rolesData.Name = result["Name"]; rolesData.Title = result["Title"]; rolesData.Description = result["Description"]; rolesData.Powers = ulong.Parse(result["Powers"]); if (result.ContainsKey("Members")) { rolesData.Members = Int32.Parse(result["Members"]); } return rolesData; }
public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID groupID) { if (m_debugEnabled) MainConsole.Instance.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", MethodBase.GetCurrentMethod().Name); List<GroupRolesData> Roles = new List<GroupRolesData>(); Dictionary<string, OSDMap> GroupRoles; if (SimianGetGenericEntries(groupID, "GroupRole", out GroupRoles)) { foreach (KeyValuePair<string, OSDMap> role in GroupRoles) { GroupRolesData data = new GroupRolesData { RoleID = UUID.Parse(role.Key), Name = role.Value["Name"].AsString(), Description = role.Value["Description"].AsString(), Title = role.Value["Title"].AsString(), Powers = role.Value["Powers"].AsULong() }; Dictionary<UUID, OSDMap> GroupRoleMembers; data.Members = SimianGetGenericEntries("GroupRole" + groupID.ToString(), role.Key, out GroupRoleMembers) ? GroupRoleMembers.Count : 0; Roles.Add(data); } } return Roles; }
public List<GroupRolesData> GetAgentGroupRoles(UUID requestingAgentID, UUID agentID, UUID groupID) { if (m_debugEnabled) MainConsole.Instance.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", MethodBase.GetCurrentMethod().Name); List<GroupRolesData> Roles = new List<GroupRolesData>(); Dictionary<string, OSDMap> GroupRoles; if (SimianGetGenericEntries(groupID, "GroupRole", out GroupRoles)) { Dictionary<string, OSDMap> MemberRoles; if (SimianGetGenericEntries(agentID, "GroupRole" + groupID.ToString(), out MemberRoles)) { #if (!ISWIN) foreach (KeyValuePair<string, OSDMap> kvp in MemberRoles) { GroupRolesData data = new GroupRolesData(); data.RoleID = UUID.Parse(kvp.Key); data.Name = GroupRoles[kvp.Key]["Name"].AsString(); data.Description = GroupRoles[kvp.Key]["Description"].AsString(); data.Title = GroupRoles[kvp.Key]["Title"].AsString(); data.Powers = GroupRoles[kvp.Key]["Powers"].AsULong(); Roles.Add(data); } #else Roles.AddRange(MemberRoles.Select(kvp => new GroupRolesData { RoleID = UUID.Parse(kvp.Key), Name = GroupRoles[kvp.Key]["Name"].AsString(), Description = GroupRoles[kvp.Key]["Description"].AsString(), Title = GroupRoles[kvp.Key]["Title"].AsString(), Powers = GroupRoles[kvp.Key]["Powers"].AsULong() })); #endif } } return Roles; }