mirror of
https://github.com/opensim/opensim.git
synced 2026-06-11 22:55:48 +08:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72c6ac378a | ||
|
|
821408215f | ||
|
|
b7da2feedd | ||
|
|
88ef8a9dbe | ||
|
|
9db019b2cc | ||
|
|
f1b74cde60 | ||
|
|
d6fd012e65 | ||
|
|
64408c9395 | ||
|
|
5b2ca76fcb | ||
|
|
c6733b8c80 | ||
|
|
d068a68583 | ||
|
|
b713c3047e |
@@ -27,6 +27,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
using OpenSim.Framework;
|
||||
using OpenMetaverse;
|
||||
@@ -96,14 +97,15 @@ namespace OpenSim.Groups
|
||||
|
||||
public class GroupsDataUtils
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static string Sanitize(string s)
|
||||
{
|
||||
return s == null ? string.Empty : s;
|
||||
return s ?? string.Empty;
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> GroupRecord(ExtendedGroupRecord grec)
|
||||
{
|
||||
Dictionary<string, object> dict = new Dictionary<string, object>();
|
||||
Dictionary<string, object> dict = [];
|
||||
if (grec == null)
|
||||
return dict;
|
||||
|
||||
@@ -132,65 +134,66 @@ namespace OpenSim.Groups
|
||||
return null;
|
||||
|
||||
ExtendedGroupRecord grec = new ExtendedGroupRecord();
|
||||
if (dict.ContainsKey("AllowPublish") && dict["AllowPublish"] != null)
|
||||
grec.AllowPublish = bool.Parse(dict["AllowPublish"].ToString());
|
||||
object otmp;
|
||||
if (dict.TryGetValue("AllowPublish", out otmp) && otmp != null)
|
||||
grec.AllowPublish = bool.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("Charter") && dict["Charter"] != null)
|
||||
grec.Charter = dict["Charter"].ToString();
|
||||
if (dict.TryGetValue("Charter", out otmp) && otmp != null)
|
||||
grec.Charter = otmp.ToString();
|
||||
else
|
||||
grec.Charter = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("FounderID") && dict["FounderID"] != null)
|
||||
if (dict.TryGetValue("FounderID", out otmp) && otmp != null)
|
||||
grec.FounderID = UUID.Parse(dict["FounderID"].ToString());
|
||||
|
||||
if (dict.ContainsKey("FounderUUI") && dict["FounderUUI"] != null)
|
||||
grec.FounderUUI = dict["FounderUUI"].ToString();
|
||||
if (dict.TryGetValue("FounderUUI", out otmp) && otmp != null)
|
||||
grec.FounderUUI = otmp.ToString();
|
||||
else
|
||||
grec.FounderUUI = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("GroupID") && dict["GroupID"] != null)
|
||||
grec.GroupID = UUID.Parse(dict["GroupID"].ToString());
|
||||
if (dict.TryGetValue("GroupID", out otmp) && otmp != null)
|
||||
grec.GroupID = UUID.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("GroupName") && dict["GroupName"] != null)
|
||||
grec.GroupName = dict["GroupName"].ToString();
|
||||
if (dict.TryGetValue("GroupName", out otmp) && otmp != null)
|
||||
grec.GroupName = otmp.ToString();
|
||||
else
|
||||
grec.GroupName = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("InsigniaID") && dict["InsigniaID"] != null)
|
||||
grec.GroupPicture = UUID.Parse(dict["InsigniaID"].ToString());
|
||||
if (dict.TryGetValue("InsigniaID", out otmp) && otmp != null)
|
||||
grec.GroupPicture = UUID.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("MaturePublish") && dict["MaturePublish"] != null)
|
||||
grec.MaturePublish = bool.Parse(dict["MaturePublish"].ToString());
|
||||
if (dict.TryGetValue("MaturePublish", out otmp) && otmp != null)
|
||||
grec.MaturePublish = bool.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("MembershipFee") && dict["MembershipFee"] != null)
|
||||
grec.MembershipFee = Int32.Parse(dict["MembershipFee"].ToString());
|
||||
if (dict.TryGetValue("MembershipFee", out otmp) && otmp != null)
|
||||
grec.MembershipFee = int.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("OpenEnrollment") && dict["OpenEnrollment"] != null)
|
||||
grec.OpenEnrollment = bool.Parse(dict["OpenEnrollment"].ToString());
|
||||
if (dict.TryGetValue("OpenEnrollment", out otmp) && otmp != null)
|
||||
grec.OpenEnrollment = bool.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("OwnerRoleID") && dict["OwnerRoleID"] != null)
|
||||
grec.OwnerRoleID = UUID.Parse(dict["OwnerRoleID"].ToString());
|
||||
if (dict.TryGetValue("OwnerRoleID", out otmp) && otmp != null)
|
||||
grec.OwnerRoleID = UUID.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("ServiceLocation") && dict["ServiceLocation"] != null)
|
||||
grec.ServiceLocation = dict["ServiceLocation"].ToString();
|
||||
if (dict.TryGetValue("ServiceLocation", out otmp) && otmp != null)
|
||||
grec.ServiceLocation = otmp.ToString();
|
||||
else
|
||||
grec.ServiceLocation = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("ShownInList") && dict["ShownInList"] != null)
|
||||
grec.ShowInList = bool.Parse(dict["ShownInList"].ToString());
|
||||
if (dict.TryGetValue("ShownInList", out otmp) && otmp != null)
|
||||
grec.ShowInList = bool.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("MemberCount") && dict["MemberCount"] != null)
|
||||
grec.MemberCount = Int32.Parse(dict["MemberCount"].ToString());
|
||||
if (dict.TryGetValue("MemberCount", out otmp) && otmp != null)
|
||||
grec.MemberCount = int.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("RoleCount") && dict["RoleCount"] != null)
|
||||
grec.RoleCount = Int32.Parse(dict["RoleCount"].ToString());
|
||||
if (dict.TryGetValue("RoleCount", out otmp) && otmp != null)
|
||||
grec.RoleCount = int.Parse(otmp.ToString());
|
||||
|
||||
return grec;
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> GroupMembershipData(ExtendedGroupMembershipData membership)
|
||||
{
|
||||
Dictionary<string, object> dict = new Dictionary<string, object>();
|
||||
Dictionary<string, object> dict = [];
|
||||
if (membership == null)
|
||||
return dict;
|
||||
|
||||
@@ -222,68 +225,68 @@ namespace OpenSim.Groups
|
||||
return null;
|
||||
|
||||
ExtendedGroupMembershipData membership = new ExtendedGroupMembershipData();
|
||||
object otmp;
|
||||
if (dict.TryGetValue("AcceptNotices", out otmp) && otmp != null)
|
||||
membership.AcceptNotices = bool.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("AcceptNotices") && dict["AcceptNotices"] != null)
|
||||
membership.AcceptNotices = bool.Parse(dict["AcceptNotices"].ToString());
|
||||
|
||||
if (dict.ContainsKey("AccessToken") && dict["AccessToken"] != null)
|
||||
membership.AccessToken = dict["AccessToken"].ToString();
|
||||
if (dict.TryGetValue("AccessToken", out otmp) && otmp != null)
|
||||
membership.AccessToken = otmp.ToString();
|
||||
else
|
||||
membership.AccessToken = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("Active") && dict["Active"] != null)
|
||||
membership.Active = bool.Parse(dict["Active"].ToString());
|
||||
if (dict.TryGetValue("Active", out otmp) && otmp != null)
|
||||
membership.Active = bool.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("ActiveRole") && dict["ActiveRole"] != null)
|
||||
membership.ActiveRole = UUID.Parse(dict["ActiveRole"].ToString());
|
||||
if (dict.TryGetValue("ActiveRole", out otmp) && otmp != null)
|
||||
membership.ActiveRole = UUID.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("AllowPublish") && dict["AllowPublish"] != null)
|
||||
membership.AllowPublish = bool.Parse(dict["AllowPublish"].ToString());
|
||||
if (dict.TryGetValue("AllowPublish", out otmp) && otmp != null)
|
||||
membership.AllowPublish = bool.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("Charter") && dict["Charter"] != null)
|
||||
membership.Charter = dict["Charter"].ToString();
|
||||
if (dict.TryGetValue("Charter", out otmp) && otmp != null)
|
||||
membership.Charter = otmp.ToString();
|
||||
else
|
||||
membership.Charter = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("Contribution") && dict["Contribution"] != null)
|
||||
membership.Contribution = Int32.Parse(dict["Contribution"].ToString());
|
||||
if (dict.TryGetValue("Contribution", out otmp) && otmp != null)
|
||||
membership.Contribution = int.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("FounderID") && dict["FounderID"] != null)
|
||||
membership.FounderID = UUID.Parse(dict["FounderID"].ToString());
|
||||
if (dict.TryGetValue("FounderID", out otmp) && otmp != null)
|
||||
membership.FounderID = UUID.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("GroupID") && dict["GroupID"] != null)
|
||||
membership.GroupID = UUID.Parse(dict["GroupID"].ToString());
|
||||
if (dict.TryGetValue("GroupID", out otmp) && otmp != null)
|
||||
membership.GroupID = UUID.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("GroupName") && dict["GroupName"] != null)
|
||||
membership.GroupName = dict["GroupName"].ToString();
|
||||
if (dict.TryGetValue("GroupName", out otmp) && otmp != null)
|
||||
membership.GroupName = otmp.ToString();
|
||||
else
|
||||
membership.GroupName = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("GroupPicture") && dict["GroupPicture"] != null)
|
||||
membership.GroupPicture = UUID.Parse(dict["GroupPicture"].ToString());
|
||||
if (dict.TryGetValue("GroupPicture", out otmp) && otmp != null)
|
||||
membership.GroupPicture = UUID.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("GroupPowers") && dict["GroupPowers"] != null)
|
||||
membership.GroupPowers = UInt64.Parse(dict["GroupPowers"].ToString());
|
||||
if (dict.TryGetValue("GroupPowers", out otmp) && otmp != null)
|
||||
membership.GroupPowers = ulong.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("GroupTitle") && dict["GroupTitle"] != null)
|
||||
membership.GroupTitle = dict["GroupTitle"].ToString();
|
||||
if (dict.TryGetValue("GroupTitle", out otmp) && otmp != null)
|
||||
membership.GroupTitle = otmp.ToString();
|
||||
else
|
||||
membership.GroupTitle = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("ListInProfile") && dict["ListInProfile"] != null)
|
||||
membership.ListInProfile = bool.Parse(dict["ListInProfile"].ToString());
|
||||
if (dict.TryGetValue("ListInProfile", out otmp) && otmp != null)
|
||||
membership.ListInProfile = bool.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("MaturePublish") && dict["MaturePublish"] != null)
|
||||
membership.MaturePublish = bool.Parse(dict["MaturePublish"].ToString());
|
||||
if (dict.TryGetValue("MaturePublish", out otmp) && otmp != null)
|
||||
membership.MaturePublish = bool.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("MembershipFee") && dict["MembershipFee"] != null)
|
||||
membership.MembershipFee = Int32.Parse(dict["MembershipFee"].ToString());
|
||||
if (dict.TryGetValue("MembershipFee", out otmp) && otmp != null)
|
||||
membership.MembershipFee = int.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("OpenEnrollment") && dict["OpenEnrollment"] != null)
|
||||
membership.OpenEnrollment = bool.Parse(dict["OpenEnrollment"].ToString());
|
||||
if (dict.TryGetValue("OpenEnrollment", out otmp) && otmp != null)
|
||||
membership.OpenEnrollment = bool.Parse(otmp.ToString());
|
||||
|
||||
if (dict.ContainsKey("ShowInList") && dict["ShowInList"] != null)
|
||||
membership.ShowInList = bool.Parse(dict["ShowInList"].ToString());
|
||||
if (dict.TryGetValue("ShowInList", out otmp) && otmp != null)
|
||||
membership.ShowInList = bool.Parse(otmp.ToString());
|
||||
|
||||
return membership;
|
||||
}
|
||||
@@ -312,38 +315,39 @@ namespace OpenSim.Groups
|
||||
if (dict == null)
|
||||
return member;
|
||||
|
||||
if (dict.ContainsKey("AcceptNotices") && dict["AcceptNotices"] != null)
|
||||
member.AcceptNotices = bool.Parse(dict["AcceptNotices"].ToString());
|
||||
object value;
|
||||
if (dict.TryGetValue("AcceptNotices", out value) && value != null)
|
||||
member.AcceptNotices = bool.Parse(value.ToString());
|
||||
|
||||
if (dict.ContainsKey("AccessToken") && dict["AccessToken"] != null)
|
||||
member.AccessToken = Sanitize(dict["AccessToken"].ToString());
|
||||
if (dict.TryGetValue("AccessToken", out value) && value != null)
|
||||
member.AccessToken = value.ToString();
|
||||
else
|
||||
member.AccessToken = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("AgentID") && dict["AgentID"] != null)
|
||||
member.AgentID = Sanitize(dict["AgentID"].ToString());
|
||||
if (dict.TryGetValue("AgentID", out value) && value != null)
|
||||
member.AgentID = value.ToString();
|
||||
else
|
||||
member.AgentID = UUID.Zero.ToString();
|
||||
member.AgentID = UUID.ZeroString;
|
||||
|
||||
if (dict.ContainsKey("AgentPowers") && dict["AgentPowers"] != null)
|
||||
member.AgentPowers = UInt64.Parse(dict["AgentPowers"].ToString());
|
||||
if (dict.TryGetValue("AgentPowers", out value) && value != null)
|
||||
member.AgentPowers = ulong.Parse(value.ToString());
|
||||
|
||||
if (dict.ContainsKey("Contribution") && dict["Contribution"] != null)
|
||||
member.Contribution = Int32.Parse(dict["Contribution"].ToString());
|
||||
if (dict.TryGetValue("Contribution", out value) && value != null)
|
||||
member.Contribution = int.Parse(value.ToString());
|
||||
|
||||
if (dict.ContainsKey("IsOwner") && dict["IsOwner"] != null)
|
||||
member.IsOwner = bool.Parse(dict["IsOwner"].ToString());
|
||||
if (dict.TryGetValue("IsOwner", out value) && value != null)
|
||||
member.IsOwner = bool.Parse(value.ToString());
|
||||
|
||||
if (dict.ContainsKey("ListInProfile") && dict["ListInProfile"] != null)
|
||||
member.ListInProfile = bool.Parse(dict["ListInProfile"].ToString());
|
||||
if (dict.TryGetValue("ListInProfile", out value) && value != null)
|
||||
member.ListInProfile = bool.Parse(value.ToString());
|
||||
|
||||
if (dict.ContainsKey("OnlineStatus") && dict["OnlineStatus"] != null)
|
||||
member.OnlineStatus = Sanitize(dict["OnlineStatus"].ToString());
|
||||
if (dict.TryGetValue("OnlineStatus", out value) && value != null)
|
||||
member.OnlineStatus = value.ToString();
|
||||
else
|
||||
member.OnlineStatus = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("Title") && dict["Title"] != null)
|
||||
member.Title = Sanitize(dict["Title"].ToString());
|
||||
if (dict.TryGetValue("Title", out value) && value != null)
|
||||
member.Title = value.ToString();
|
||||
else
|
||||
member.Title = string.Empty;
|
||||
|
||||
@@ -371,123 +375,116 @@ namespace OpenSim.Groups
|
||||
if (dict == null)
|
||||
return role;
|
||||
|
||||
if (dict.ContainsKey("Description") && dict["Description"] != null)
|
||||
role.Description = Sanitize(dict["Description"].ToString());
|
||||
object value;
|
||||
if (dict.TryGetValue("Description", out value) && value != null)
|
||||
role.Description = value.ToString();
|
||||
else
|
||||
role.Description = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("Members") && dict["Members"] != null)
|
||||
role.Members = Int32.Parse(dict["Members"].ToString());
|
||||
if (dict.TryGetValue("Members", out value) && value != null)
|
||||
role.Members = int.Parse(value.ToString());
|
||||
|
||||
if (dict.ContainsKey("Name") && dict["Name"] != null)
|
||||
role.Name = Sanitize(dict["Name"].ToString());
|
||||
if (dict.TryGetValue("Name", out value) && value != null)
|
||||
role.Name = value.ToString();
|
||||
else
|
||||
role.Name = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("Powers") && dict["Powers"] != null)
|
||||
role.Powers = UInt64.Parse(dict["Powers"].ToString());
|
||||
if (dict.TryGetValue("Powers", out value) && value != null)
|
||||
role.Powers = ulong.Parse(value.ToString());
|
||||
|
||||
if (dict.ContainsKey("Title") && dict["Title"] != null)
|
||||
role.Title = Sanitize(dict["Title"].ToString());
|
||||
if (dict.TryGetValue("Title", out value) && value != null)
|
||||
role.Title = value.ToString();
|
||||
else
|
||||
role.Title = string.Empty;
|
||||
|
||||
if (dict.ContainsKey("RoleID") && dict["RoleID"] != null)
|
||||
role.RoleID = UUID.Parse(dict["RoleID"].ToString());
|
||||
if (dict.TryGetValue("RoleID", out value) && value != null)
|
||||
role.RoleID = UUID.Parse(value.ToString());
|
||||
|
||||
return role;
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> GroupRoleMembersData(ExtendedGroupRoleMembersData rmember)
|
||||
{
|
||||
Dictionary<string, object> dict = new Dictionary<string, object>();
|
||||
|
||||
dict["RoleID"] = rmember.RoleID.ToString();
|
||||
dict["MemberID"] = rmember.MemberID;
|
||||
return dict;
|
||||
return new Dictionary<string, object>()
|
||||
{
|
||||
["RoleID"] = rmember.RoleID.ToString(),
|
||||
["MemberID"] = rmember.MemberID
|
||||
};
|
||||
}
|
||||
|
||||
public static ExtendedGroupRoleMembersData GroupRoleMembersData(Dictionary<string, object> dict)
|
||||
{
|
||||
ExtendedGroupRoleMembersData rmember = new ExtendedGroupRoleMembersData();
|
||||
|
||||
if (dict.ContainsKey("RoleID") && dict["RoleID"] != null)
|
||||
rmember.RoleID = new UUID(dict["RoleID"].ToString());
|
||||
object value;
|
||||
if (dict.TryGetValue("RoleID", out value) && value != null)
|
||||
rmember.RoleID = new UUID(value.ToString());
|
||||
|
||||
if (dict.ContainsKey("MemberID") && dict["MemberID"] != null)
|
||||
rmember.MemberID = dict["MemberID"].ToString();
|
||||
if (dict.TryGetValue("MemberID", out value) && value != null)
|
||||
rmember.MemberID = value.ToString();
|
||||
|
||||
return rmember;
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> GroupInviteInfo(GroupInviteInfo invite)
|
||||
{
|
||||
Dictionary<string, object> dict = new Dictionary<string, object>();
|
||||
|
||||
dict["InviteID"] = invite.InviteID.ToString();
|
||||
dict["GroupID"] = invite.GroupID.ToString();
|
||||
dict["RoleID"] = invite.RoleID.ToString();
|
||||
dict["AgentID"] = invite.AgentID;
|
||||
|
||||
return dict;
|
||||
return new Dictionary<string, object>()
|
||||
{
|
||||
["InviteID"] = invite.InviteID.ToString(),
|
||||
["GroupID"] = invite.GroupID.ToString(),
|
||||
["RoleID"] = invite.RoleID.ToString(),
|
||||
["AgentID"] = invite.AgentID
|
||||
};
|
||||
}
|
||||
|
||||
public static GroupInviteInfo GroupInviteInfo(Dictionary<string, object> dict)
|
||||
{
|
||||
if (dict == null)
|
||||
return null;
|
||||
|
||||
GroupInviteInfo invite = new GroupInviteInfo();
|
||||
|
||||
invite.InviteID = new UUID(dict["InviteID"].ToString());
|
||||
invite.GroupID = new UUID(dict["GroupID"].ToString());
|
||||
invite.RoleID = new UUID(dict["RoleID"].ToString());
|
||||
invite.AgentID = Sanitize(dict["AgentID"].ToString());
|
||||
|
||||
return invite;
|
||||
return dict == null ? null :
|
||||
new GroupInviteInfo
|
||||
{
|
||||
InviteID = new UUID(dict["InviteID"].ToString()),
|
||||
GroupID = new UUID(dict["GroupID"].ToString()),
|
||||
RoleID = new UUID(dict["RoleID"].ToString()),
|
||||
AgentID = Sanitize(dict["AgentID"].ToString())
|
||||
};
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> GroupNoticeData(ExtendedGroupNoticeData notice)
|
||||
{
|
||||
Dictionary<string, object> dict = new Dictionary<string, object>();
|
||||
|
||||
dict["NoticeID"] = notice.NoticeID.ToString();
|
||||
dict["Timestamp"] = notice.Timestamp.ToString();
|
||||
dict["FromName"] = Sanitize(notice.FromName);
|
||||
dict["Subject"] = Sanitize(notice.Subject);
|
||||
dict["HasAttachment"] = notice.HasAttachment.ToString();
|
||||
dict["AttachmentItemID"] = notice.AttachmentItemID.ToString();
|
||||
dict["AttachmentName"] = Sanitize(notice.AttachmentName);
|
||||
dict["AttachmentType"] = notice.AttachmentType.ToString();
|
||||
dict["AttachmentOwnerID"] = Sanitize(notice.AttachmentOwnerID);
|
||||
|
||||
return dict;
|
||||
return new Dictionary<string, object>
|
||||
{
|
||||
["NoticeID"] = notice.NoticeID.ToString(),
|
||||
["Timestamp"] = notice.Timestamp.ToString(),
|
||||
["FromName"] = Sanitize(notice.FromName),
|
||||
["Subject"] = Sanitize(notice.Subject),
|
||||
["HasAttachment"] = notice.HasAttachment.ToString(),
|
||||
["AttachmentItemID"] = notice.AttachmentItemID.ToString(),
|
||||
["AttachmentName"] = Sanitize(notice.AttachmentName),
|
||||
["AttachmentType"] = notice.AttachmentType.ToString(),
|
||||
["AttachmentOwnerID"] = Sanitize(notice.AttachmentOwnerID)
|
||||
};
|
||||
}
|
||||
|
||||
public static ExtendedGroupNoticeData GroupNoticeData(Dictionary<string, object> dict)
|
||||
{
|
||||
ExtendedGroupNoticeData notice = new ExtendedGroupNoticeData();
|
||||
|
||||
if (dict == null)
|
||||
return notice;
|
||||
|
||||
notice.NoticeID = new UUID(dict["NoticeID"].ToString());
|
||||
notice.Timestamp = UInt32.Parse(dict["Timestamp"].ToString());
|
||||
notice.FromName = Sanitize(dict["FromName"].ToString());
|
||||
notice.Subject = Sanitize(dict["Subject"].ToString());
|
||||
notice.HasAttachment = bool.Parse(dict["HasAttachment"].ToString());
|
||||
notice.AttachmentItemID = new UUID(dict["AttachmentItemID"].ToString());
|
||||
notice.AttachmentName = dict["AttachmentName"].ToString();
|
||||
notice.AttachmentType = byte.Parse(dict["AttachmentType"].ToString());
|
||||
notice.AttachmentOwnerID = dict["AttachmentOwnerID"].ToString();
|
||||
|
||||
return notice;
|
||||
}
|
||||
return dict == null ? new ExtendedGroupNoticeData() :
|
||||
new ExtendedGroupNoticeData()
|
||||
{
|
||||
NoticeID = new UUID(dict["NoticeID"].ToString()),
|
||||
Timestamp = uint.Parse(dict["Timestamp"].ToString()),
|
||||
FromName = Sanitize(dict["FromName"].ToString()),
|
||||
Subject = Sanitize(dict["Subject"].ToString()),
|
||||
HasAttachment = bool.Parse(dict["HasAttachment"].ToString()),
|
||||
AttachmentItemID = new UUID(dict["AttachmentItemID"].ToString()),
|
||||
AttachmentName = dict["AttachmentName"].ToString(),
|
||||
AttachmentType = byte.Parse(dict["AttachmentType"].ToString()),
|
||||
AttachmentOwnerID = dict["AttachmentOwnerID"].ToString()
|
||||
};
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> GroupNoticeInfo(GroupNoticeInfo notice)
|
||||
{
|
||||
Dictionary<string, object> dict = GroupNoticeData(notice.noticeData);
|
||||
|
||||
dict["GroupID"] = notice.GroupID.ToString();
|
||||
dict["Message"] = Sanitize(notice.Message);
|
||||
|
||||
@@ -496,25 +493,23 @@ namespace OpenSim.Groups
|
||||
|
||||
public static GroupNoticeInfo GroupNoticeInfo(Dictionary<string, object> dict)
|
||||
{
|
||||
GroupNoticeInfo notice = new GroupNoticeInfo();
|
||||
|
||||
notice.noticeData = GroupNoticeData(dict);
|
||||
notice.GroupID = new UUID(dict["GroupID"].ToString());
|
||||
notice.Message = Sanitize(dict["Message"].ToString());
|
||||
|
||||
return notice;
|
||||
return new GroupNoticeInfo
|
||||
{
|
||||
noticeData = GroupNoticeData(dict),
|
||||
GroupID = new UUID(dict["GroupID"].ToString()),
|
||||
Message = Sanitize(dict["Message"].ToString())
|
||||
};
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> DirGroupsReplyData(DirGroupsReplyData g)
|
||||
{
|
||||
Dictionary<string, object> dict = new Dictionary<string, object>();
|
||||
|
||||
dict["GroupID"] = g.groupID;
|
||||
dict["Name"] = g.groupName;
|
||||
dict["NMembers"] = g.members;
|
||||
dict["SearchOrder"] = g.searchOrder;
|
||||
|
||||
return dict;
|
||||
return new Dictionary<string, object>
|
||||
{
|
||||
["GroupID"] = g.groupID,
|
||||
["Name"] = g.groupName,
|
||||
["NMembers"] = g.members,
|
||||
["SearchOrder"] = g.searchOrder
|
||||
};
|
||||
}
|
||||
|
||||
public static DirGroupsReplyData DirGroupsReplyData(Dictionary<string, object> dict)
|
||||
@@ -523,7 +518,7 @@ namespace OpenSim.Groups
|
||||
|
||||
g.groupID = new UUID(dict["GroupID"].ToString());
|
||||
g.groupName = dict["Name"].ToString();
|
||||
Int32.TryParse(dict["NMembers"].ToString(), out g.members);
|
||||
int.TryParse(dict["NMembers"].ToString(), out g.members);
|
||||
float.TryParse(dict["SearchOrder"].ToString(), out g.searchOrder);
|
||||
|
||||
return g;
|
||||
|
||||
@@ -71,12 +71,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return false;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oresult))
|
||||
return false;
|
||||
|
||||
if (ret["RESULT"].ToString().ToLower() != "true")
|
||||
string result = oresult.ToString();
|
||||
if (!result.Equals("true", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
reason = ret["REASON"].ToString();
|
||||
reason = result;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -112,13 +113,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return null;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return null;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
|
||||
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]);
|
||||
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)oRESULT);
|
||||
}
|
||||
|
||||
public List<ExtendedGroupMembersData> GetGroupMembers(string RequestingAgentID, UUID GroupID, string token)
|
||||
@@ -134,12 +135,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return members;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return members;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return members;
|
||||
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
|
||||
|
||||
foreach (object v in ((Dictionary<string, object>)oRESULT).Values)
|
||||
{
|
||||
ExtendedGroupMembersData m = GroupsDataUtils.GroupMembersData((Dictionary<string, object>)v);
|
||||
members.Add(m);
|
||||
@@ -161,12 +163,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return roles;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return roles;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return roles;
|
||||
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
|
||||
|
||||
foreach (object v in ((Dictionary<string, object>)oRESULT).Values)
|
||||
{
|
||||
GroupRolesData m = GroupsDataUtils.GroupRolesData((Dictionary<string, object>)v);
|
||||
roles.Add(m);
|
||||
@@ -188,13 +191,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return rmembers;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return rmembers;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return rmembers;
|
||||
|
||||
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
|
||||
foreach (object v in ((Dictionary<string, object>)oRESULT).Values)
|
||||
{
|
||||
ExtendedGroupRoleMembersData m = GroupsDataUtils.GroupRoleMembersData((Dictionary<string, object>)v);
|
||||
rmembers.Add(m);
|
||||
@@ -227,13 +230,10 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return false;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object value))
|
||||
return false;
|
||||
|
||||
if (ret["RESULT"].ToString().ToLower() != "true")
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return value.ToString().Equals("true", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public bool VerifyNotice(UUID noticeID, UUID groupID)
|
||||
@@ -246,13 +246,10 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return false;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object value))
|
||||
return false;
|
||||
|
||||
if (ret["RESULT"].ToString().ToLower() != "true")
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return value.ToString().Equals("true", StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -42,6 +42,7 @@ using OpenMetaverse;
|
||||
using Mono.Addins;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenSim.Groups
|
||||
{
|
||||
@@ -680,14 +681,11 @@ namespace OpenSim.Groups
|
||||
{
|
||||
lock (m_NetworkConnectors)
|
||||
{
|
||||
if (m_NetworkConnectors.ContainsKey(url))
|
||||
return m_NetworkConnectors[url];
|
||||
|
||||
GroupsServiceHGConnector c = new GroupsServiceHGConnector(url);
|
||||
m_NetworkConnectors[url] = c;
|
||||
ref GroupsServiceHGConnector connector = ref CollectionsMarshal.GetValueRefOrAddDefault(m_NetworkConnectors,url, out bool exists);
|
||||
if(!exists)
|
||||
connector = new GroupsServiceHGConnector(url);
|
||||
return connector;
|
||||
}
|
||||
|
||||
return m_NetworkConnectors[url];
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -128,11 +128,10 @@ namespace OpenSim.Groups
|
||||
Dictionary<string, object> request =
|
||||
ServerUtils.ParseQueryString(body);
|
||||
|
||||
if (!request.ContainsKey("METHOD"))
|
||||
if(!request.Remove("METHOD", out object omethod))
|
||||
return FailureResult();
|
||||
|
||||
string method = request["METHOD"].ToString();
|
||||
request.Remove("METHOD");
|
||||
string method = omethod.ToString();
|
||||
|
||||
m_log.DebugFormat("[Groups.RobustHGConnector]: {0}", method);
|
||||
switch (method)
|
||||
@@ -169,24 +168,24 @@ namespace OpenSim.Groups
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
|
||||
if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("GroupID")
|
||||
|| !request.ContainsKey("AgentID")
|
||||
|| !request.ContainsKey("AccessToken") || !request.ContainsKey("Location"))
|
||||
if (!request.TryGetValue("RequestingAgentID", out object oRequestingAgentID) ||
|
||||
!request.TryGetValue("GroupID", out object oGroupID) ||
|
||||
!request.TryGetValue("AgentID", out object oAgentID) ||
|
||||
!request.TryGetValue("AccessToken", out object oAccessToken) ||
|
||||
!request.TryGetValue("Location", out object oLocation))
|
||||
NullResult(result, "Bad network data");
|
||||
|
||||
else
|
||||
{
|
||||
string RequestingAgentID = request["RequestingAgentID"].ToString();
|
||||
string agentID = request["AgentID"].ToString();
|
||||
UUID groupID = new UUID(request["GroupID"].ToString());
|
||||
string accessToken = request["AccessToken"].ToString();
|
||||
string location = request["Location"].ToString();
|
||||
string RequestingAgentID = oRequestingAgentID.ToString();
|
||||
string agentID = oAgentID.ToString();
|
||||
UUID groupID = new UUID(oGroupID.ToString());
|
||||
string accessToken = oAccessToken.ToString();
|
||||
string location = oLocation.ToString();
|
||||
string name = string.Empty;
|
||||
if (request.ContainsKey("Name"))
|
||||
name = request["Name"].ToString();
|
||||
if (request.TryGetValue("Name", out object oName))
|
||||
name = oName.ToString();
|
||||
|
||||
string reason = string.Empty;
|
||||
bool success = m_GroupsService.CreateGroupProxy(RequestingAgentID, agentID, accessToken, groupID, location, name, out reason);
|
||||
bool success = m_GroupsService.CreateGroupProxy(RequestingAgentID, agentID, accessToken, groupID, location, name, out string reason);
|
||||
result["REASON"] = reason;
|
||||
result["RESULT"] = success.ToString();
|
||||
}
|
||||
@@ -256,16 +255,18 @@ namespace OpenSim.Groups
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
|
||||
if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("GroupID") || !request.ContainsKey("AccessToken"))
|
||||
if (!request.TryGetValue("RequestingAgentID", out object oRequestingAgentID) ||
|
||||
!request.TryGetValue("GroupID", out object oGroupID) ||
|
||||
!request.TryGetValue("AccessToken", out object oAccessToken))
|
||||
NullResult(result, "Bad network data");
|
||||
else
|
||||
{
|
||||
UUID groupID = new UUID(request["GroupID"].ToString());
|
||||
string requestingAgentID = request["RequestingAgentID"].ToString();
|
||||
string token = request["AccessToken"].ToString();
|
||||
UUID groupID = new UUID(oGroupID.ToString());
|
||||
string requestingAgentID = oRequestingAgentID.ToString();
|
||||
string token = oAccessToken.ToString();
|
||||
|
||||
List<ExtendedGroupMembersData> members = m_GroupsService.GetGroupMembers(requestingAgentID, groupID, token);
|
||||
if (members == null || (members != null && members.Count == 0))
|
||||
if (members == null || members.Count == 0)
|
||||
{
|
||||
NullResult(result, "No members");
|
||||
}
|
||||
@@ -292,16 +293,18 @@ namespace OpenSim.Groups
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
|
||||
if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("GroupID") || !request.ContainsKey("AccessToken"))
|
||||
if (!request.TryGetValue("RequestingAgentID", out object oRequestingAgentID) ||
|
||||
!request.TryGetValue("GroupID", out object oGroupID) ||
|
||||
!request.TryGetValue("AccessToken", out object oAccessToken))
|
||||
NullResult(result, "Bad network data");
|
||||
else
|
||||
{
|
||||
UUID groupID = new UUID(request["GroupID"].ToString());
|
||||
string requestingAgentID = request["RequestingAgentID"].ToString();
|
||||
string token = request["AccessToken"].ToString();
|
||||
UUID groupID = new UUID(oGroupID.ToString());
|
||||
string requestingAgentID = oRequestingAgentID.ToString();
|
||||
string token = oAccessToken.ToString();
|
||||
|
||||
List<GroupRolesData> roles = m_GroupsService.GetGroupRoles(requestingAgentID, groupID, token);
|
||||
if (roles == null || (roles != null && roles.Count == 0))
|
||||
if (roles == null || roles.Count == 0)
|
||||
{
|
||||
NullResult(result, "No members");
|
||||
}
|
||||
@@ -326,16 +329,18 @@ namespace OpenSim.Groups
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
|
||||
if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("GroupID") || !request.ContainsKey("AccessToken"))
|
||||
if (!request.TryGetValue("RequestingAgentID", out object oRequestingAgentID) ||
|
||||
!request.TryGetValue("GroupID", out object oGroupID) ||
|
||||
!request.TryGetValue("AccessToken", out object oAccessToken))
|
||||
NullResult(result, "Bad network data");
|
||||
else
|
||||
{
|
||||
UUID groupID = new UUID(request["GroupID"].ToString());
|
||||
string requestingAgentID = request["RequestingAgentID"].ToString();
|
||||
string token = request["AccessToken"].ToString();
|
||||
UUID groupID = new UUID(oGroupID.ToString());
|
||||
string requestingAgentID = oRequestingAgentID.ToString();
|
||||
string token = oAccessToken.ToString();
|
||||
|
||||
List<ExtendedGroupRoleMembersData> rmembers = m_GroupsService.GetGroupRoleMembers(requestingAgentID, groupID, token);
|
||||
if (rmembers == null || (rmembers != null && rmembers.Count == 0))
|
||||
if (rmembers == null || rmembers.Count == 0)
|
||||
{
|
||||
NullResult(result, "No members");
|
||||
}
|
||||
@@ -360,31 +365,35 @@ namespace OpenSim.Groups
|
||||
{
|
||||
Dictionary<string, object> result = new Dictionary<string, object>();
|
||||
|
||||
if (!request.ContainsKey("RequestingAgentID") || !request.ContainsKey("GroupID") || !request.ContainsKey("NoticeID") ||
|
||||
!request.ContainsKey("FromName") || !request.ContainsKey("Subject") || !request.ContainsKey("Message") ||
|
||||
!request.ContainsKey("HasAttachment"))
|
||||
if (!request.TryGetValue("RequestingAgentID", out object oRequestingAgentID) ||
|
||||
!request.TryGetValue("GroupID", out object oGroupID) ||
|
||||
!request.TryGetValue("NoticeID", out object oNoticeID) ||
|
||||
!request.TryGetValue("FromName", out object oFromName) ||
|
||||
!request.TryGetValue("Subject", out object oSubject) ||
|
||||
!request.TryGetValue("Message", out object oMessage) ||
|
||||
!request.TryGetValue("HasAttachment", out object oHasAttachment))
|
||||
NullResult(result, "Bad network data");
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
bool hasAtt = bool.Parse(request["HasAttachment"].ToString());
|
||||
bool hasAtt = bool.Parse(oHasAttachment.ToString());
|
||||
byte attType = 0;
|
||||
string attName = string.Empty;
|
||||
string attOwner = string.Empty;
|
||||
UUID attItem = UUID.Zero;
|
||||
if (request.ContainsKey("AttachmentType"))
|
||||
attType = byte.Parse(request["AttachmentType"].ToString());
|
||||
if (request.ContainsKey("AttachmentName"))
|
||||
attName = request["AttachmentType"].ToString();
|
||||
if (request.ContainsKey("AttachmentItemID"))
|
||||
attItem = new UUID(request["AttachmentItemID"].ToString());
|
||||
if (request.ContainsKey("AttachmentOwnerID"))
|
||||
attOwner = request["AttachmentOwnerID"].ToString();
|
||||
if (request.TryGetValue("AttachmentType", out object oAttachmentType))
|
||||
attType = byte.Parse(oAttachmentType.ToString());
|
||||
|
||||
bool success = m_GroupsService.AddNotice(request["RequestingAgentID"].ToString(), new UUID(request["GroupID"].ToString()),
|
||||
new UUID(request["NoticeID"].ToString()), request["FromName"].ToString(), request["Subject"].ToString(),
|
||||
request["Message"].ToString(), hasAtt, attType, attName, attItem, attOwner);
|
||||
if (request.TryGetValue("AttachmentName", out object oAttachmentName))
|
||||
attName = oAttachmentName.ToString();
|
||||
if (request.TryGetValue("AttachmentItemID", out object oAttachmentItemID))
|
||||
attItem = new UUID(oAttachmentItemID.ToString());
|
||||
if (request.TryGetValue("AttachmentOwnerID", out object oAttachmentOwnerID))
|
||||
attOwner = oAttachmentOwnerID.ToString();
|
||||
|
||||
bool success = m_GroupsService.AddNotice(oRequestingAgentID.ToString(), new UUID(oGroupID.ToString()),
|
||||
new UUID(oNoticeID.ToString()), oFromName.ToString(), oSubject.ToString(),
|
||||
oMessage.ToString(), hasAtt, attType, attName, attItem, attOwner);
|
||||
|
||||
result["RESULT"] = success.ToString();
|
||||
}
|
||||
|
||||
@@ -25,19 +25,19 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.ServiceAuth;
|
||||
using OpenSim.Server.Base;
|
||||
|
||||
using OpenMetaverse;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Groups
|
||||
{
|
||||
@@ -99,13 +99,16 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return null;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return null;
|
||||
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
reason = ret["REASON"].ToString();
|
||||
return null;
|
||||
}
|
||||
|
||||
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]);
|
||||
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)oRESULT);
|
||||
|
||||
}
|
||||
|
||||
@@ -126,10 +129,13 @@ namespace OpenSim.Groups
|
||||
sendData["OP"] = "UPDATE";
|
||||
Dictionary<string, object> ret = MakeRequest("PUTGROUP", sendData);
|
||||
|
||||
if (ret == null || (ret != null && (!ret.ContainsKey("RESULT") || ret["RESULT"].ToString() == "NULL")))
|
||||
if (ret == null || !ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return null;
|
||||
|
||||
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]);
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
|
||||
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)oRESULT);
|
||||
}
|
||||
|
||||
public ExtendedGroupRecord GetGroupRecord(string RequestingAgentID, UUID GroupID, string GroupName)
|
||||
@@ -147,10 +153,13 @@ namespace OpenSim.Groups
|
||||
|
||||
Dictionary<string, object> ret = MakeRequest("GETGROUP", sendData);
|
||||
|
||||
if (ret == null || (ret != null && (!ret.ContainsKey("RESULT") || ret["RESULT"].ToString() == "NULL")))
|
||||
if (ret == null || !ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return null;
|
||||
|
||||
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)ret["RESULT"]);
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
|
||||
return GroupsDataUtils.GroupRecord((Dictionary<string, object>)oRESULT);
|
||||
}
|
||||
|
||||
public List<DirGroupsReplyData> FindGroups(string RequestingAgentIDstr, string query)
|
||||
@@ -168,13 +177,10 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return hits;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT) || oRESULT.ToString() == "NULL")
|
||||
return hits;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
return hits;
|
||||
|
||||
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
|
||||
foreach (object v in ((Dictionary<string, object>)oRESULT).Values)
|
||||
{
|
||||
DirGroupsReplyData m = GroupsDataUtils.DirGroupsReplyData((Dictionary<string, object>)v);
|
||||
hits.Add(m);
|
||||
@@ -198,16 +204,16 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return null;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return null;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT.ToString() == "NULL")
|
||||
{
|
||||
reason = ret["REASON"].ToString();
|
||||
return null;
|
||||
}
|
||||
|
||||
return GroupsDataUtils.GroupMembershipData((Dictionary<string, object>)ret["RESULT"]);
|
||||
return GroupsDataUtils.GroupMembershipData((Dictionary<string, object>)oRESULT);
|
||||
|
||||
}
|
||||
|
||||
@@ -232,13 +238,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return null;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return null;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT.ToString() == "NULL")
|
||||
return null;
|
||||
|
||||
return GroupsDataUtils.GroupMembershipData((Dictionary<string, object>)ret["RESULT"]);
|
||||
return GroupsDataUtils.GroupMembershipData((Dictionary<string, object>)oRESULT);
|
||||
}
|
||||
|
||||
public List<GroupMembershipData> GetMemberships(string RequestingAgentID, string AgentID)
|
||||
@@ -254,13 +260,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return memberships;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return memberships;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT.ToString() == "NULL")
|
||||
return memberships;
|
||||
|
||||
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
|
||||
foreach (object v in ((Dictionary<string, object>)oRESULT).Values)
|
||||
{
|
||||
GroupMembershipData m = GroupsDataUtils.GroupMembershipData((Dictionary<string, object>)v);
|
||||
memberships.Add(m);
|
||||
@@ -282,13 +288,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return members;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return members;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT.ToString() == "NULL")
|
||||
return members;
|
||||
|
||||
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
|
||||
foreach (object v in ((Dictionary<string, object>)oRESULT).Values)
|
||||
{
|
||||
ExtendedGroupMembersData m = GroupsDataUtils.GroupMembersData((Dictionary<string, object>)v);
|
||||
members.Add(m);
|
||||
@@ -315,10 +321,10 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return false;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return false;
|
||||
|
||||
if (ret["RESULT"].ToString().ToLower() != "true")
|
||||
if (!oRESULT.ToString().Equals("true", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
reason = ret["REASON"].ToString();
|
||||
return false;
|
||||
@@ -343,13 +349,10 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return false;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return false;
|
||||
|
||||
if (ret["RESULT"].ToString().ToLower() != "true")
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return !oRESULT.ToString().Equals("true", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public void RemoveGroupRole(string RequestingAgentID, UUID groupID, UUID roleID)
|
||||
@@ -373,13 +376,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return roles;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return roles;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return roles;
|
||||
|
||||
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
|
||||
foreach (object v in ((Dictionary<string, object>)oRESULT).Values)
|
||||
{
|
||||
GroupRolesData m = GroupsDataUtils.GroupRolesData((Dictionary<string, object>)v);
|
||||
roles.Add(m);
|
||||
@@ -400,13 +403,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return rmembers;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return rmembers;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return rmembers;
|
||||
|
||||
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
|
||||
foreach (object v in ((Dictionary<string, object>)oRESULT).Values)
|
||||
{
|
||||
ExtendedGroupRoleMembersData m = GroupsDataUtils.GroupRoleMembersData((Dictionary<string, object>)v);
|
||||
rmembers.Add(m);
|
||||
@@ -429,13 +432,10 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return false;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return false;
|
||||
|
||||
if (ret["RESULT"].ToString().ToLower() != "true")
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return oRESULT.ToString().Equals("true", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public bool RemoveAgentFromGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
|
||||
@@ -452,13 +452,10 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return false;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return false;
|
||||
|
||||
if (ret["RESULT"].ToString().ToLower() != "true")
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return oRESULT.ToString().Equals("true", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public List<GroupRolesData> GetAgentGroupRoles(string RequestingAgentID, string AgentID, UUID GroupID)
|
||||
@@ -474,13 +471,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return roles;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return roles;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return roles;
|
||||
|
||||
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
|
||||
foreach (object v in ((Dictionary<string, object>)oRESULT).Values)
|
||||
{
|
||||
GroupRolesData m = GroupsDataUtils.GroupRolesData((Dictionary<string, object>)v);
|
||||
roles.Add(m);
|
||||
@@ -502,13 +499,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return null;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return null;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
|
||||
return GroupsDataUtils.GroupMembershipData((Dictionary<string, object>)ret["RESULT"]);
|
||||
return GroupsDataUtils.GroupMembershipData((Dictionary<string, object>)oRESULT);
|
||||
}
|
||||
|
||||
public void SetAgentActiveGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
|
||||
@@ -549,13 +546,10 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return false;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return false;
|
||||
|
||||
if (ret["RESULT"].ToString().ToLower() != "true") // it may return "NULL"
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return oRESULT.ToString().Equals("true", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public GroupInviteInfo GetAgentToGroupInvite(string RequestingAgentID, UUID inviteID)
|
||||
@@ -570,13 +564,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return null;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return null;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
|
||||
return GroupsDataUtils.GroupInviteInfo((Dictionary<string, object>)ret["RESULT"]);
|
||||
return GroupsDataUtils.GroupInviteInfo((Dictionary<string, object>)oRESULT);
|
||||
}
|
||||
|
||||
public void RemoveAgentToGroupInvite(string RequestingAgentID, UUID inviteID)
|
||||
@@ -613,13 +607,10 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return false;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return false;
|
||||
|
||||
if (ret["RESULT"].ToString().ToLower() != "true")
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return oRESULT.ToString().Equals("true", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public GroupNoticeInfo GetGroupNotice(string RequestingAgentID, UUID noticeID)
|
||||
@@ -633,13 +624,14 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return null;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return null;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return null;
|
||||
|
||||
return GroupsDataUtils.GroupNoticeInfo((Dictionary<string, object>)ret["RESULT"]);
|
||||
|
||||
return GroupsDataUtils.GroupNoticeInfo((Dictionary<string, object>)oRESULT);
|
||||
}
|
||||
|
||||
public List<ExtendedGroupNoticeData> GetGroupNotices(string RequestingAgentID, UUID GroupID)
|
||||
@@ -654,13 +646,13 @@ namespace OpenSim.Groups
|
||||
if (ret == null)
|
||||
return notices;
|
||||
|
||||
if (!ret.ContainsKey("RESULT"))
|
||||
if (!ret.TryGetValue("RESULT", out object oRESULT))
|
||||
return notices;
|
||||
|
||||
if (ret["RESULT"].ToString() == "NULL")
|
||||
if (oRESULT is string sRESULT && sRESULT.Equals("NULL", StringComparison.OrdinalIgnoreCase))
|
||||
return notices;
|
||||
|
||||
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
|
||||
foreach (object v in ((Dictionary<string, object>)oRESULT).Values)
|
||||
{
|
||||
ExtendedGroupNoticeData m = GroupsDataUtils.GroupNoticeData((Dictionary<string, object>)v);
|
||||
notices.Add(m);
|
||||
|
||||
@@ -274,33 +274,31 @@ namespace OpenSim.Groups
|
||||
UUID ownerRoleID = new UUID(group.Data["OwnerRoleID"]);
|
||||
|
||||
RoleData[] roles = m_Database.RetrieveRoles(GroupID);
|
||||
if (roles == null)
|
||||
// something wrong with this group
|
||||
if (roles == null || roles.Length == 0)
|
||||
return members;
|
||||
List<RoleData> rolesList = new List<RoleData>(roles);
|
||||
|
||||
List<RoleData> rolesList = new List<RoleData>(roles);
|
||||
// Let's find the "real" ownerRoleID
|
||||
RoleData ownerRole = rolesList.Find(r => r.Data["Powers"] == ((long)OwnerPowers).ToString());
|
||||
string OwnerPowersstr = ((long)OwnerPowers).ToString();
|
||||
RoleData ownerRole = rolesList.Find(r => OwnerPowersstr.Equals(r.Data["Powers"]));
|
||||
if (ownerRole != null)
|
||||
ownerRoleID = ownerRole.RoleID;
|
||||
|
||||
// Check visibility?
|
||||
// When we don't want to check visibility, we pass it "all" as the requestingAgentID
|
||||
bool checkVisibility = !RequestingAgentID.Equals(UUID.Zero.ToString());
|
||||
bool checkVisibility = !RequestingAgentID.Equals(UUID.ZeroString);
|
||||
|
||||
if (checkVisibility)
|
||||
{
|
||||
// Is the requester a member of the group?
|
||||
bool isInGroup = false;
|
||||
if (m_Database.RetrieveMember(GroupID, RequestingAgentID) != null)
|
||||
isInGroup = true;
|
||||
bool isInGroup = m_Database.RetrieveMember(GroupID, RequestingAgentID) != null;
|
||||
|
||||
if (!isInGroup) // reduce the roles to the visible ones
|
||||
rolesList = rolesList.FindAll(r => (UInt64.Parse(r.Data["Powers"]) & (ulong)GroupPowers.MemberVisible) != 0);
|
||||
}
|
||||
|
||||
MembershipData[] datas = m_Database.RetrieveMembers(GroupID);
|
||||
if (datas == null || (datas != null && datas.Length == 0))
|
||||
if (datas == null || datas.Length == 0)
|
||||
return members;
|
||||
|
||||
// OK, we have everything we need
|
||||
@@ -323,27 +321,27 @@ namespace OpenSim.Groups
|
||||
}
|
||||
|
||||
m.AgentID = d.PrincipalID;
|
||||
m.AcceptNotices = d.Data["AcceptNotices"] == "1" ? true : false;
|
||||
m.AcceptNotices = d.Data["AcceptNotices"] == "1";
|
||||
m.Contribution = Int32.Parse(d.Data["Contribution"]);
|
||||
m.ListInProfile = d.Data["ListInProfile"] == "1" ? true : false;
|
||||
m.ListInProfile = d.Data["ListInProfile"] == "1";
|
||||
|
||||
GridUserData gud = m_GridUserService.Get(d.PrincipalID);
|
||||
if (gud != null)
|
||||
{
|
||||
if (bool.Parse(gud.Data["Online"]))
|
||||
{
|
||||
m.OnlineStatus = @"Online";
|
||||
m.OnlineStatus = "Online";
|
||||
}
|
||||
else
|
||||
{
|
||||
int unixtime = int.Parse(gud.Data["Login"]);
|
||||
// The viewer is very picky about how these strings are formed. Eg. it will crash on malformed dates!
|
||||
m.OnlineStatus = (unixtime == 0) ? @"unknown" : Util.ToDateTime(unixtime).ToString("MM/dd/yyyy");
|
||||
m.OnlineStatus = (unixtime == 0) ? "unknown" : Util.ToDateTime(unixtime).ToString("MM/dd/yyyy");
|
||||
}
|
||||
}
|
||||
|
||||
// Is this person an owner of the group?
|
||||
m.IsOwner = (rolemembershipsList.Find(r => r.RoleID == ownerRoleID) != null) ? true : false;
|
||||
m.IsOwner = rolemembershipsList.Find(r => r.RoleID.Equals(ownerRoleID)) != null;
|
||||
|
||||
members.Add(m);
|
||||
}
|
||||
@@ -353,17 +351,16 @@ namespace OpenSim.Groups
|
||||
|
||||
public bool AddGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers, out string reason)
|
||||
{
|
||||
reason = string.Empty;
|
||||
// check that the requesting agent has permissions to add role
|
||||
if (!HasPower(RequestingAgentID, groupID, GroupPowers.CreateRole))
|
||||
{
|
||||
m_log.DebugFormat("[Groups]: ({0}) Attempt at creating role in group {1} denied because of lack of permission", RequestingAgentID, groupID);
|
||||
m_log.Debug($"[Groups]: ({RequestingAgentID}) Attempt at creating role in group {groupID} denied because of lack of permission");
|
||||
reason = "Insufficient permission to create role";
|
||||
return false;
|
||||
}
|
||||
|
||||
reason = string.Empty;
|
||||
return _AddOrUpdateGroupRole(RequestingAgentID, groupID, roleID, name, description, title, powers, true);
|
||||
|
||||
}
|
||||
|
||||
public bool UpdateGroupRole(string RequestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers)
|
||||
@@ -371,7 +368,7 @@ namespace OpenSim.Groups
|
||||
// check perms
|
||||
if (!HasPower(RequestingAgentID, groupID, GroupPowers.ChangeActions))
|
||||
{
|
||||
m_log.DebugFormat("[Groups]: ({0}) Attempt at changing role in group {1} denied because of lack of permission", RequestingAgentID, groupID);
|
||||
m_log.Debug($"[Groups]: ({RequestingAgentID}) Attempt at changing role in group {groupID} denied because of lack of permission");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -380,30 +377,30 @@ namespace OpenSim.Groups
|
||||
|
||||
public void RemoveGroupRole(string RequestingAgentID, UUID groupID, UUID roleID)
|
||||
{
|
||||
// check perms
|
||||
if (!HasPower(RequestingAgentID, groupID, GroupPowers.DeleteRole))
|
||||
{
|
||||
m_log.DebugFormat("[Groups]: ({0}) Attempt at deleting role from group {1} denied because of lack of permission", RequestingAgentID, groupID);
|
||||
return;
|
||||
}
|
||||
|
||||
// Can't delete Everyone and Owners roles
|
||||
if (roleID.IsZero())
|
||||
{
|
||||
m_log.DebugFormat("[Groups]: Attempt at deleting Everyone role from group {0} denied", groupID);
|
||||
m_log.Debug($"[Groups]: Attempt at deleting Everyone role from group {groupID} denied");
|
||||
return;
|
||||
}
|
||||
|
||||
// check perms
|
||||
if (!HasPower(RequestingAgentID, groupID, GroupPowers.DeleteRole))
|
||||
{
|
||||
m_log.Debug($"[Groups]: ({RequestingAgentID}) Attempt at deleting role from group {groupID} denied because of lack of permission");
|
||||
return;
|
||||
}
|
||||
|
||||
GroupData group = m_Database.RetrieveGroup(groupID);
|
||||
if (group == null)
|
||||
{
|
||||
m_log.DebugFormat("[Groups]: Attempt at deleting role from non-existing group {0}", groupID);
|
||||
m_log.Debug($"[Groups]: Attempt at deleting role from non-existing group {groupID}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (roleID == new UUID(group.Data["OwnerRoleID"]))
|
||||
if (roleID.ToString().Equals(group.Data["OwnerRoleID"]))
|
||||
{
|
||||
m_log.DebugFormat("[Groups]: Attempt at deleting Owners role from group {0} denied", groupID);
|
||||
m_log.Debug($"[Groups]: Attempt at deleting Owners role from group {groupID} denied");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -421,9 +418,7 @@ namespace OpenSim.Groups
|
||||
// TODO: check perms
|
||||
|
||||
// Is the requester a member of the group?
|
||||
bool isInGroup = false;
|
||||
if (m_Database.RetrieveMember(GroupID, RequestingAgentID) != null)
|
||||
isInGroup = true;
|
||||
bool isInGroup = m_Database.RetrieveMember(GroupID, RequestingAgentID) != null;
|
||||
|
||||
return _GetGroupRoleMembers(GroupID, isInGroup);
|
||||
}
|
||||
@@ -500,15 +495,19 @@ namespace OpenSim.Groups
|
||||
|
||||
public bool AddAgentToGroupRole(string RequestingAgentID, string AgentID, UUID GroupID, UUID RoleID)
|
||||
{
|
||||
//if (!m_Database.CheckOwnerRole(RequestingAgentID, GroupID, RoleID))
|
||||
// return;
|
||||
|
||||
// check permissions
|
||||
bool limited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMemberLimited);
|
||||
bool unlimited = HasPower(RequestingAgentID, GroupID, GroupPowers.AssignMember) || IsOwner(RequestingAgentID, GroupID);
|
||||
bool limited = false;
|
||||
bool unlimited = IsOwner(RequestingAgentID, GroupID);
|
||||
if(!unlimited)
|
||||
{
|
||||
ulong upowers =(ulong)GetAgentGroupPowers(RequestingAgentID, GroupID);
|
||||
limited = (upowers & (ulong)GroupPowers.AssignMemberLimited) != 0;
|
||||
unlimited = (upowers & (ulong)GroupPowers.AssignMember) != 0;
|
||||
}
|
||||
|
||||
if (!limited && !unlimited)
|
||||
{
|
||||
m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of lack of permission", RequestingAgentID, AgentID, RoleID);
|
||||
m_log.Debug($"[Groups]: ({RequestingAgentID}) Attempt at assigning {AgentID} to role {RoleID} denied because of lack of permission");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -519,7 +518,7 @@ namespace OpenSim.Groups
|
||||
RoleMembershipData rolemembership = m_Database.RetrieveRoleMember(GroupID, RoleID, RequestingAgentID);
|
||||
if (rolemembership == null)
|
||||
{
|
||||
m_log.DebugFormat("[Groups]: ({0}) Attempt at assigning {1} to role {2} denied because of limited permission", RequestingAgentID, AgentID, RoleID);
|
||||
m_log.Debug($"[Groups]: ({RequestingAgentID}) Attempt at assigning {AgentID} to role {RoleID} denied because of limited permission");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -588,11 +587,11 @@ namespace OpenSim.Groups
|
||||
|
||||
public List<GroupRolesData> GetAgentGroupRoles(string RequestingAgentID, string AgentID, UUID GroupID)
|
||||
{
|
||||
List<GroupRolesData> roles = new List<GroupRolesData>();
|
||||
List<GroupRolesData> roles = [];
|
||||
// TODO: check permissions
|
||||
|
||||
RoleMembershipData[] data = m_Database.RetrieveMemberRoles(GroupID, AgentID);
|
||||
if (data == null || (data != null && data.Length ==0))
|
||||
if (data == null || data.Length ==0)
|
||||
return roles;
|
||||
|
||||
foreach (RoleMembershipData d in data)
|
||||
@@ -601,11 +600,13 @@ namespace OpenSim.Groups
|
||||
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"];
|
||||
GroupRolesData r = new GroupRolesData
|
||||
{
|
||||
Name = rdata.Data["Name"],
|
||||
Powers = UInt64.Parse(rdata.Data["Powers"]),
|
||||
RoleID = rdata.RoleID,
|
||||
Title = rdata.Data["Title"]
|
||||
};
|
||||
|
||||
roles.Add(r);
|
||||
}
|
||||
@@ -1053,19 +1054,20 @@ namespace OpenSim.Groups
|
||||
notice.AttachmentOwnerID = data.Data["AttachmentOwnerID"].ToString();
|
||||
}
|
||||
|
||||
|
||||
return notice;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region permissions
|
||||
private bool HasPower(string agentID, UUID groupID, GroupPowers power)
|
||||
|
||||
public GroupPowers GetAgentGroupPowers(string agentID, UUID groupID)
|
||||
{
|
||||
RoleMembershipData[] rmembership = m_Database.RetrieveMemberRoles(groupID, agentID);
|
||||
if (rmembership is null || rmembership.Length == 0)
|
||||
return false;
|
||||
return 0;
|
||||
|
||||
ulong powers = 0;
|
||||
foreach (RoleMembershipData rdata in rmembership)
|
||||
{
|
||||
if(rdata is null)
|
||||
@@ -1080,7 +1082,36 @@ namespace OpenSim.Groups
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((UInt64.Parse(role.Data["Powers"]) & (ulong)power) != 0)
|
||||
if (role.Data.TryGetValue("Powers", out string psrt) &&
|
||||
ulong.TryParse(psrt, out ulong ut))
|
||||
powers |= ut;
|
||||
}
|
||||
return (GroupPowers)powers;
|
||||
}
|
||||
|
||||
private bool HasPower(string agentID, UUID groupID, GroupPowers power)
|
||||
{
|
||||
RoleMembershipData[] rmembership = m_Database.RetrieveMemberRoles(groupID, agentID);
|
||||
if (rmembership is null || rmembership.Length == 0)
|
||||
return false;
|
||||
|
||||
ulong upower = (ulong)power;
|
||||
foreach (RoleMembershipData rdata in rmembership)
|
||||
{
|
||||
if(rdata is null)
|
||||
{
|
||||
m_log.Warn($"[GROUPSERVICE] null membership data entry in group {groupID} for agent {agentID}");
|
||||
continue;
|
||||
}
|
||||
RoleData role = m_Database.RetrieveRole(groupID, rdata.RoleID);
|
||||
if (role is null)
|
||||
{
|
||||
m_log.Warn($"[GROUPSERVICE] role with id {rdata.RoleID} is null");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (role.Data.TryGetValue("Powers", out string psrt) &&
|
||||
ulong.TryParse(psrt, out ulong ut) && (ut & upower) != 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -246,6 +246,7 @@ namespace OpenSim.Framework
|
||||
/// <param name="b"></param>
|
||||
/// <param name="c"></param>
|
||||
/// <returns></returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static double lerp(double a, double b, double c)
|
||||
{
|
||||
return (b * a) + (c * (1 - a));
|
||||
@@ -424,6 +425,7 @@ namespace OpenSim.Framework
|
||||
// legacy, do not use
|
||||
public static Random RandomClass
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get { return Random.Shared;}
|
||||
}
|
||||
|
||||
@@ -2230,9 +2232,9 @@ namespace OpenSim.Framework
|
||||
/// <returns></returns>
|
||||
public static T GetConfigVarFromSections<T>(IConfigSource config, string varname, string[] sections, object val)
|
||||
{
|
||||
foreach (string section in sections.AsSpan())
|
||||
for (int i = 0 ; i < sections.Length; i++)
|
||||
{
|
||||
IConfig cnf = config.Configs[section];
|
||||
IConfig cnf = config.Configs[sections[i]];
|
||||
if (cnf == null)
|
||||
continue;
|
||||
|
||||
@@ -2250,6 +2252,119 @@ namespace OpenSim.Framework
|
||||
return (T)val;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of a configuration variable by looking into
|
||||
/// multiple sections in order. Returns as soon one is found, ignoring other sections
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If no value is found then the given default value is returned
|
||||
/// </remarks>
|
||||
/// <typeparam name="T">Type of the variable</typeparam>
|
||||
/// <param name="config">The configuration object</param>
|
||||
/// <param name="varname">The configuration variable</param>
|
||||
/// <param name="sections">Ordered sequence of sections to look at</param>
|
||||
/// <param name="val">Default value</param>
|
||||
/// <returns></returns>
|
||||
public static T GetFirstConfigVarFromSections<T>(IConfigSource config, string varname, string[] sections, object val)
|
||||
{
|
||||
for (int i = 0 ; i < sections.Length; i++)
|
||||
{
|
||||
IConfig cnf = config.Configs[sections[i]];
|
||||
if (cnf == null)
|
||||
continue;
|
||||
|
||||
string text = cnf.Get(varname);
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
{
|
||||
if (typeof(T) == typeof(string))
|
||||
return Unsafe.As<string, T>(ref text);
|
||||
|
||||
if (typeof(T) == typeof(bool))
|
||||
{
|
||||
bool b = bool.Parse(text);
|
||||
return Unsafe.As<bool, T>(ref b);
|
||||
}
|
||||
|
||||
if (typeof(T) == typeof(int))
|
||||
{
|
||||
int ti = int.Parse(text);
|
||||
return Unsafe.As<int, T>(ref ti);
|
||||
}
|
||||
|
||||
if (typeof(T) == typeof(float))
|
||||
{
|
||||
float f = float.Parse(text);
|
||||
return Unsafe.As<float, T>(ref f);
|
||||
}
|
||||
|
||||
if (typeof(T) == typeof(double))
|
||||
{
|
||||
double d = double.Parse(text);
|
||||
return Unsafe.As<double, T>(ref d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return val == null ? default : (T) val;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of a configuration variable by looking into
|
||||
/// multiple sections in order. Returns as soon one is found, ignoring other sections
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If no value is found then the default value of T is returned
|
||||
/// </remarks>
|
||||
/// <typeparam name="T">Type of the variable</typeparam>
|
||||
/// <param name="config">The configuration object</param>
|
||||
/// <param name="varname">The configuration variable</param>
|
||||
/// <param name="sections">Ordered sequence of sections to look at</param>
|
||||
/// <returns></returns>
|
||||
|
||||
public static T GetFirstConfigVarFromSections<T>(IConfigSource config, string varname, string[] sections)
|
||||
{
|
||||
for (int i = 0 ; i < sections.Length; i++)
|
||||
{
|
||||
IConfig cnf = config.Configs[sections[i]];
|
||||
if (cnf == null)
|
||||
continue;
|
||||
|
||||
string text = cnf.Get(varname);
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
{
|
||||
if (typeof(T) == typeof(string))
|
||||
return Unsafe.As<string, T>(ref text);
|
||||
|
||||
if (typeof(T) == typeof(bool))
|
||||
{
|
||||
bool b = bool.Parse(text);
|
||||
return Unsafe.As<bool, T>(ref b);
|
||||
}
|
||||
|
||||
if (typeof(T) == typeof(int))
|
||||
{
|
||||
int ti = int.Parse(text);
|
||||
return Unsafe.As<int, T>(ref ti);
|
||||
}
|
||||
|
||||
if (typeof(T) == typeof(float))
|
||||
{
|
||||
float f = float.Parse(text);
|
||||
return Unsafe.As<float, T>(ref f);
|
||||
}
|
||||
|
||||
if (typeof(T) == typeof(double))
|
||||
{
|
||||
double d = double.Parse(text);
|
||||
return Unsafe.As<double, T>(ref d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
|
||||
public static void MergeEnvironmentToConfig(IConfigSource ConfigSource)
|
||||
{
|
||||
IConfig enVars = ConfigSource.Configs["Environment"];
|
||||
|
||||
@@ -100,16 +100,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
IConfigSource config = m_Scene.Config;
|
||||
if (config is not null)
|
||||
{
|
||||
IConfig sconfig = config.Configs["Startup"];
|
||||
if (sconfig is not null)
|
||||
ConfigOptions.levelUpload = sconfig.GetInt("LevelUpload", 0);
|
||||
|
||||
if (ConfigOptions.levelUpload == 0)
|
||||
{
|
||||
IConfig pconfig = config.Configs["Permissions"];
|
||||
if (pconfig is not null)
|
||||
ConfigOptions.levelUpload = pconfig.GetInt("LevelUpload", 0);
|
||||
}
|
||||
ConfigOptions.levelUpload = Util.GetFirstConfigVarFromSections<int>(config,"LevelUpload",["Permissions", "Startup"], 0);
|
||||
|
||||
IConfig appearanceConfig = config.Configs["Appearance"];
|
||||
if (appearanceConfig is not null)
|
||||
|
||||
@@ -305,11 +305,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
lock(dropedResponses)
|
||||
{
|
||||
if(dropedResponses.Contains(requestID))
|
||||
{
|
||||
dropedResponses.Remove(requestID);
|
||||
if(dropedResponses.Remove(requestID))
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,9 +318,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
lock(dropedResponses)
|
||||
{
|
||||
if(dropedResponses.Contains(requestID))
|
||||
if(dropedResponses.Remove(requestID))
|
||||
{
|
||||
dropedResponses.Remove(requestID);
|
||||
ProcessedRequestsCount++;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4438,8 +4438,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
data[pos++] = 0;
|
||||
// AppearanceHover vector 3
|
||||
data[pos++] = 1;
|
||||
Utils.FloatToBytesSafepos(0, data, pos); pos += 4;
|
||||
Utils.FloatToBytesSafepos(0, data, pos); pos += 4;
|
||||
//Utils.FloatToBytesSafepos(0, data, pos); pos += 4;
|
||||
//Utils.FloatToBytesSafepos(0, data, pos); pos += 4;
|
||||
Utils.Int64ZeroToBytes(data, pos); pos += 8;
|
||||
Utils.FloatToBytesSafepos(hover, data, pos); pos += 4;
|
||||
|
||||
buf.DataLength = pos;
|
||||
@@ -6738,26 +6739,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
#endregion
|
||||
|
||||
#region Helper Methods
|
||||
private static void ClampVectorForUint(ref Vector3 v, float max)
|
||||
{
|
||||
float a, b;
|
||||
|
||||
a = MathF.Abs(v.X);
|
||||
b = MathF.Abs(v.Y);
|
||||
if (b > a)
|
||||
a = b;
|
||||
b = MathF.Abs(v.Z);
|
||||
if (b > a)
|
||||
a = b;
|
||||
|
||||
if (a > max)
|
||||
{
|
||||
a = max / a;
|
||||
v.X *= a;
|
||||
v.Y *= a;
|
||||
v.Z *= a;
|
||||
}
|
||||
}
|
||||
|
||||
protected static void CreateImprovedTerseBlock(ISceneEntity entity, byte[] data, ref int pos, bool includeTexture)
|
||||
{
|
||||
@@ -6834,7 +6815,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
data[pos++] = 1;
|
||||
|
||||
//m_log.DebugFormat("CollisionPlane: {0}",collisionPlane);
|
||||
if (collisionPlane == Vector4.Zero)
|
||||
if (collisionPlane.IsZero())
|
||||
Vector4.UnitW.ToBytes(data, pos);
|
||||
else
|
||||
collisionPlane.ToBytes(data, pos);
|
||||
@@ -6846,33 +6827,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
|
||||
// Position
|
||||
position.ToBytes(data, pos);
|
||||
pos += 12;
|
||||
position.ToBytes(data, pos); pos += 12;
|
||||
|
||||
// Velocity
|
||||
ClampVectorForUint(ref velocity, 128f);
|
||||
Utils.FloatToUInt16Bytes(velocity.X, 128.0f, data, pos); pos += 2;
|
||||
Utils.FloatToUInt16Bytes(velocity.Y, 128.0f, data, pos); pos += 2;
|
||||
Utils.FloatToUInt16Bytes(velocity.Z, 128.0f, data, pos); pos += 2;
|
||||
velocity.ClampedToShortsBytes(128f,data,pos); pos += 6;
|
||||
|
||||
// Acceleration
|
||||
ClampVectorForUint(ref acceleration, 64f);
|
||||
Utils.FloatToUInt16Bytes(acceleration.X, 64.0f, data, pos); pos += 2;
|
||||
Utils.FloatToUInt16Bytes(acceleration.Y, 64.0f, data, pos); pos += 2;
|
||||
Utils.FloatToUInt16Bytes(acceleration.Z, 64.0f, data, pos); pos += 2;
|
||||
acceleration.ClampedToShortsBytes(64f, data, pos); pos += 6;
|
||||
|
||||
// Rotation
|
||||
|
||||
Utils.FloatToUInt16Bytes(rotation.X, 1.0f, data, pos); pos += 2;
|
||||
Utils.FloatToUInt16Bytes(rotation.Y, 1.0f, data, pos); pos += 2;
|
||||
Utils.FloatToUInt16Bytes(rotation.Z, 1.0f, data, pos); pos += 2;
|
||||
Utils.FloatToUInt16Bytes(rotation.W, 1.0f, data, pos); pos += 2;
|
||||
rotation.ToShortsBytes(data, pos); pos += 8;
|
||||
|
||||
// Angular Velocity
|
||||
ClampVectorForUint(ref angularVelocity, 64f);
|
||||
Utils.FloatToUInt16Bytes(angularVelocity.X, 64.0f, data, pos); pos += 2;
|
||||
Utils.FloatToUInt16Bytes(angularVelocity.Y, 64.0f, data, pos); pos += 2;
|
||||
Utils.FloatToUInt16Bytes(angularVelocity.Z, 64.0f, data, pos); pos += 2;
|
||||
angularVelocity.ClampedToShortsBytes(64f, data, pos); pos += 6;
|
||||
|
||||
// texture entry block size
|
||||
if (te is null)
|
||||
|
||||
@@ -32,6 +32,7 @@ using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
using log4net;
|
||||
using OpenSim.Framework.Monitoring;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
@@ -114,29 +115,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
public Packet GetPacket(PacketType type)
|
||||
{
|
||||
PacketsRequested++;
|
||||
|
||||
Packet packet;
|
||||
|
||||
if (!RecyclePackets)
|
||||
return Packet.BuildPacket(type);
|
||||
|
||||
Packet packet;
|
||||
lock (pool)
|
||||
{
|
||||
if (!pool.ContainsKey(type) || pool[type] == null || (pool[type]).Count == 0)
|
||||
if (!pool.TryGetValue(type, out Stack<Packet> typePacketsStack) || typePacketsStack == null || typePacketsStack.Count == 0)
|
||||
{
|
||||
// m_log.DebugFormat("[PACKETPOOL]: Building {0} packet", type);
|
||||
|
||||
// Creating a new packet if we cannot reuse an old package
|
||||
//m_log.DebugFormat("[PACKETPOOL]: Building {0} packet", type);
|
||||
packet = Packet.BuildPacket(type);
|
||||
}
|
||||
else
|
||||
{
|
||||
// m_log.DebugFormat("[PACKETPOOL]: Pulling {0} packet", type);
|
||||
//m_log.DebugFormat("[PACKETPOOL]: Pulling {0} packet", type);
|
||||
|
||||
// Recycle old packages
|
||||
PacketsReused++;
|
||||
|
||||
packet = pool[type].Pop();
|
||||
packet = typePacketsStack.Pop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +195,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
if (!RecyclePackets)
|
||||
return;
|
||||
|
||||
bool trypool = false;
|
||||
PacketType type = packet.Type;
|
||||
|
||||
switch (type)
|
||||
@@ -207,83 +202,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
case PacketType.ObjectUpdate:
|
||||
ObjectUpdatePacket oup = (ObjectUpdatePacket)packet;
|
||||
oup.ObjectData = null;
|
||||
trypool = true;
|
||||
break;
|
||||
|
||||
case PacketType.ImprovedTerseObjectUpdate:
|
||||
ImprovedTerseObjectUpdatePacket itoup = (ImprovedTerseObjectUpdatePacket)packet;
|
||||
itoup.ObjectData = null;
|
||||
trypool = true;
|
||||
break;
|
||||
|
||||
case PacketType.PacketAck:
|
||||
PacketAckPacket ackup = (PacketAckPacket)packet;
|
||||
ackup.Packets = null;
|
||||
trypool = true;
|
||||
break;
|
||||
|
||||
case PacketType.AgentUpdate:
|
||||
trypool = true;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if(!trypool)
|
||||
return;
|
||||
|
||||
lock (pool)
|
||||
{
|
||||
if (!pool.ContainsKey(type))
|
||||
ref Stack<Packet> spkt = ref CollectionsMarshal.GetValueRefOrAddDefault(pool, type, out bool exists);
|
||||
if (exists && spkt.Count < 50)
|
||||
{
|
||||
pool[type] = new Stack<Packet>();
|
||||
spkt.Push(packet);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((pool[type]).Count < 50)
|
||||
{
|
||||
// m_log.DebugFormat("[PACKETPOOL]: Pushing {0} packet", type);
|
||||
pool[type].Push(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public T GetDataBlock<T>() where T: new()
|
||||
{
|
||||
lock (DataBlocks)
|
||||
{
|
||||
BlocksRequested++;
|
||||
|
||||
Stack<Object> s;
|
||||
|
||||
if (DataBlocks.TryGetValue(typeof(T), out s))
|
||||
{
|
||||
if (s.Count > 0)
|
||||
{
|
||||
BlocksReused++;
|
||||
return (T)s.Pop();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DataBlocks[typeof(T)] = new Stack<Object>();
|
||||
}
|
||||
|
||||
return new T();
|
||||
}
|
||||
}
|
||||
|
||||
public void ReturnDataBlock<T>(T block) where T: new()
|
||||
{
|
||||
if (block == null)
|
||||
return;
|
||||
|
||||
lock (DataBlocks)
|
||||
{
|
||||
if (!DataBlocks.ContainsKey(typeof(T)))
|
||||
DataBlocks[typeof(T)] = new Stack<Object>();
|
||||
|
||||
if (DataBlocks[typeof(T)].Count < 50)
|
||||
DataBlocks[typeof(T)].Push(block);
|
||||
spkt = new Stack<Packet>();
|
||||
spkt.Push(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using Mono.Addins;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
{
|
||||
@@ -51,18 +52,14 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
/// <summary>
|
||||
/// Each agent has its own singleton collection of transactions
|
||||
/// </summary>
|
||||
private Dictionary<UUID, AgentAssetTransactions> AgentTransactions =
|
||||
new Dictionary<UUID, AgentAssetTransactions>();
|
||||
private Dictionary<UUID, AgentAssetTransactions> AgentTransactions = [];
|
||||
|
||||
#region Region Module interface
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig sconfig = source.Configs["Startup"];
|
||||
if (sconfig != null)
|
||||
{
|
||||
m_levelUpload = sconfig.GetInt("LevelUpload", 0);
|
||||
}
|
||||
if(source != null)
|
||||
m_levelUpload = Util.GetFirstConfigVarFromSections<int>(source,"LevelUpload",["Permissions", "Startup"], 0);
|
||||
}
|
||||
|
||||
public void AddRegion(Scene scene)
|
||||
@@ -113,16 +110,11 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
{
|
||||
lock (AgentTransactions)
|
||||
{
|
||||
if (!AgentTransactions.ContainsKey(userID))
|
||||
{
|
||||
AgentAssetTransactions transactions =
|
||||
new AgentAssetTransactions(userID, m_Scene,
|
||||
m_dumpAssetsToFile);
|
||||
ref AgentAssetTransactions value = ref CollectionsMarshal.GetValueRefOrAddDefault(AgentTransactions, userID, out bool exists);
|
||||
if (!exists)
|
||||
value = new AgentAssetTransactions(userID, m_Scene, m_dumpAssetsToFile);
|
||||
|
||||
AgentTransactions.Add(userID, transactions);
|
||||
}
|
||||
|
||||
return AgentTransactions[userID];
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,8 +209,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
// "[ASSET TRANSACTION MODULE]: Called HandleTaskItemUpdateFromTransaction with item {0} in {1} for {2} in {3}",
|
||||
// item.Name, part.Name, remoteClient.Name, m_Scene.RegionInfo.RegionName);
|
||||
|
||||
AgentAssetTransactions transactions =
|
||||
GetUserTransactions(remoteClient.AgentId);
|
||||
AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
|
||||
|
||||
transactions.RequestUpdateTaskInventoryItem(remoteClient, part,
|
||||
transactionID, item);
|
||||
@@ -247,9 +238,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
(AssetType)type == AssetType.Animation) &&
|
||||
tempFile == false)
|
||||
{
|
||||
ScenePresence avatar = null;
|
||||
Scene scene = (Scene)remoteClient.Scene;
|
||||
scene.TryGetScenePresence(remoteClient.AgentId, out avatar);
|
||||
scene.TryGetScenePresence(remoteClient.AgentId, out ScenePresence avatar);
|
||||
|
||||
// check user level
|
||||
if (avatar != null)
|
||||
|
||||
@@ -994,7 +994,8 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||
try
|
||||
{
|
||||
// If the file is already cached, don't cache it, just touch it so access time is updated
|
||||
if (!replace && File.Exists(filename))
|
||||
bool fileExists = File.Exists(filename);
|
||||
if (!replace && fileExists)
|
||||
{
|
||||
if (m_updateFileTimeOnCacheHit)
|
||||
UpdateFileLastAccessTime(filename);
|
||||
@@ -1031,7 +1032,7 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||
|
||||
try
|
||||
{
|
||||
if(replace)
|
||||
if(fileExists)
|
||||
File.Delete(filename);
|
||||
File.Move(tempname, filename);
|
||||
}
|
||||
|
||||
@@ -528,7 +528,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||
|
||||
// Create a new asset for user
|
||||
AssetBase asset = new AssetBase(
|
||||
UUID.Random(), "DynamicImage" + Util.RandomClass.Next(1, 10000), (sbyte)AssetType.Texture,
|
||||
UUID.Random(), "DynamicImage" + Random.Shared.Next(1, 10000), (sbyte)AssetType.Texture,
|
||||
part.OwnerID.ToString());
|
||||
asset.Data = assetData;
|
||||
asset.Description = string.Format("URL image : {0}", Url);
|
||||
|
||||
@@ -253,7 +253,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
m_hasGroupChanged = value;
|
||||
|
||||
//m_log.DebugFormat(
|
||||
// "[SCENE OBJECT GROUP]: HasGroupChanged set to {0} for {1} {2}", m_hasGroupChanged, Name, LocalId);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml;
|
||||
@@ -147,15 +148,14 @@ namespace OpenSim.Region.DataSnapshot
|
||||
#region Response storage
|
||||
public XmlNode GetScene(Scene scene, XmlDocument factory)
|
||||
{
|
||||
m_log.Debug("[DATASNAPSHOT]: Data requested for scene " + scene.RegionInfo.RegionName);
|
||||
m_log.Debug("[DATASNAPSHOT]: Data requested for scene " + scene.Name);
|
||||
|
||||
if (!m_scenes.ContainsKey(scene)) {
|
||||
m_scenes.Add(scene, true); //stale by default
|
||||
}
|
||||
ref bool sceneStale = ref CollectionsMarshal.GetValueRefOrAddDefault(m_scenes, scene, out bool exists);
|
||||
sceneStale |= !exists;
|
||||
|
||||
XmlNode regionElement = null;
|
||||
|
||||
if (!m_scenes[scene])
|
||||
if (!sceneStale)
|
||||
{
|
||||
m_log.Debug("[DATASNAPSHOT]: Attempting to retrieve snapshot from cache.");
|
||||
//get snapshot from cache
|
||||
@@ -212,7 +212,7 @@ namespace OpenSim.Region.DataSnapshot
|
||||
m_log.WarnFormat("[DATASNAPSHOT]: Exception on writing to file {0}: {1}", path, e.Message);
|
||||
}
|
||||
|
||||
m_scenes[scene] = false;
|
||||
sceneStale = false;
|
||||
|
||||
m_log.Debug("[DATASNAPSHOT]: Generated new snapshot for " + scene.RegionInfo.RegionName);
|
||||
}
|
||||
@@ -258,7 +258,6 @@ namespace OpenSim.Region.DataSnapshot
|
||||
//attr.Value = scene.LandManager.landList.Count.ToString();
|
||||
//docElement.Attributes.Append(attr);
|
||||
|
||||
|
||||
XmlNode infoblock = basedoc.CreateNode(XmlNodeType.Element, "info", "");
|
||||
|
||||
XmlNode infopiece = basedoc.CreateNode(XmlNodeType.Element, "uuid", "");
|
||||
|
||||
@@ -2942,7 +2942,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||
if(obj is OTOpndBinOp)
|
||||
sb.Append(')');
|
||||
sb.Append('.');
|
||||
sb.Append(field.Name);
|
||||
sb.Append(this.field.Name);
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
@@ -3548,9 +3548,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||
{
|
||||
get
|
||||
{
|
||||
if(field.DeclaringType == typeof(ScriptBaseClass))
|
||||
return field.Name;
|
||||
return field.DeclaringType.Name + "." + field.Name;
|
||||
if(this.field.DeclaringType == typeof(ScriptBaseClass))
|
||||
return this.field.Name;
|
||||
return this.field.DeclaringType.Name + "." + this.field.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,9 +450,11 @@ namespace OpenSim.Services.LLLoginService
|
||||
//
|
||||
// Authenticate this user
|
||||
//
|
||||
if (!passwd.StartsWith("$1$"))
|
||||
passwd = "$1$" + Util.Md5Hash(passwd);
|
||||
passwd = passwd.Remove(0, 3); //remove $1$
|
||||
if (passwd.StartsWith("$1$"))
|
||||
passwd = passwd[3..];
|
||||
else
|
||||
passwd = Util.Md5Hash(passwd);
|
||||
|
||||
string token = m_AuthenticationService.Authenticate(account.PrincipalID, passwd, 30, out UUID realID);
|
||||
UUID secureSession = UUID.Zero;
|
||||
if (string.IsNullOrWhiteSpace(token) || !UUID.TryParse(token, out secureSession))
|
||||
|
||||
BIN
bin/CSJ2K.dll
BIN
bin/CSJ2K.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user