本文整理汇总了C#中OpenSim.Region.OptionalModules.Avatar.FlexiGroups.GroupRequestID类的典型用法代码示例。如果您正苦于以下问题:C# GroupRequestID类的具体用法?C# GroupRequestID怎么用?C# GroupRequestID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GroupRequestID类属于OpenSim.Region.OptionalModules.Avatar.FlexiGroups命名空间,在下文中一共展示了GroupRequestID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateGroup
public OpenMetaverse.UUID CreateGroup(GroupRequestID requestID, string name, string charter, bool showInList, OpenMetaverse.UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, OpenMetaverse.UUID founderID)
{
using (ISimpleDB db = GetConnection())
{
if (db == null)
return UUID.Zero;
UUID groupID = UUID.Random();
UUID ownerRoleID = UUID.Random();
// Would this be cleaner as (GroupPowers)ulong.MaxValue;
GroupPowers ownerPowers = (GroupPowers)ulong.MaxValue;
string query
= "INSERT INTO osgroup " +
"(GroupID, Name, Charter, InsigniaID, FounderID, MembershipFee, OpenEnrollment, " +
"ShowInList, AllowPublish, MaturePublish, OwnerRoleID) " +
"VALUES(?groupid, ?name, ?charter, ?insigniaID, ?founderID, ?membershipFee, " +
"?openEnrollment, ?showInList, ?allowPublish, ?maturePublish, ?ownerRoleID)";
Dictionary<string, object> parms = new Dictionary<string,object>();
parms.Add("?groupid", groupID);
parms.Add("?name", name);
parms.Add("?charter", charter);
parms.Add("?insigniaID", insigniaID);
parms.Add("?founderID", founderID);
parms.Add("?membershipFee", membershipFee.ToString());
parms.Add("?openEnrollment", openEnrollment);
parms.Add("?showInList", showInList);
parms.Add("?allowPublish", allowPublish);
parms.Add("?maturePublish", maturePublish);
parms.Add("?ownerRoleID", ownerRoleID);
db.QueryNoResults(query, parms);
this.AddGroupRole(requestID, groupID, EVERYONE_ROLEID, "Everyone", "Everyone in the group is in the everyone role.", "Member of " + name, (ulong)Constants.DefaultEveryonePowers, true);
this.AddGroupRole(requestID, groupID, ownerRoleID, "Owners", "Owners of " + name, "Owner of " + name, (ulong) ownerPowers, true);
this.AddAgentToGroup(requestID, founderID, groupID, ownerRoleID, true);
this.SetAgentGroupSelectedRole(db, founderID, groupID, ownerRoleID);
this.SetAgentActiveGroup(requestID, founderID, groupID);
return groupID;
}
}
示例2: CreateGroup
/// <summary>
/// Create a Group, including Everyone and Owners Role, place FounderID in both groups, select Owner as selected role, and newly created group as agent's active role.
/// </summary>
public UUID CreateGroup(GroupRequestID requestID, string name, string charter, bool showInList, UUID insigniaID,
int membershipFee, bool openEnrollment, bool allowPublish,
bool maturePublish, UUID founderID)
{
UUID GroupID = UUID.Random();
UUID OwnerRoleID = UUID.Random();
Hashtable param = new Hashtable();
param["GroupID"] = GroupID.ToString();
param["Name"] = name;
param["Charter"] = charter;
param["ShowInList"] = showInList == true ? 1 : 0;
param["InsigniaID"] = insigniaID.ToString();
param["MembershipFee"] = 0;
param["OpenEnrollment"] = openEnrollment == true ? 1 : 0;
param["AllowPublish"] = allowPublish == true ? 1 : 0;
param["MaturePublish"] = maturePublish == true ? 1 : 0;
param["FounderID"] = founderID.ToString();
param["EveryonePowers"] = ((ulong)Constants.DefaultEveryonePowers).ToString();
param["OwnerRoleID"] = OwnerRoleID.ToString();
// Would this be cleaner as (GroupPowers)ulong.MaxValue;
GroupPowers OwnerPowers = (GroupPowers)ulong.MaxValue;
param["OwnersPowers"] = ((ulong)OwnerPowers).ToString();
Hashtable respData = XmlRpcCall(requestID, "groups.createGroup", param);
if (respData.Contains("error"))
{
// UUID is not nullable
return UUID.Zero;
}
return UUID.Parse((string)respData["GroupID"]);
}
示例3: UpdateGroupRole
public void UpdateGroupRole(GroupRequestID requestID, OpenMetaverse.UUID groupID, OpenMetaverse.UUID roleID,
string name, string description, string title, ulong powers)
{
if (!TestForPower(requestID, requestID.AgentID, groupID, (ulong)GroupPowers.RoleProperties))
{
m_log.WarnFormat("[GROUPS]: {0} No permission to change group roles", requestID.AgentID);
return;
}
string query = "UPDATE osrole SET RoleID = ?roleID ";
Dictionary<string, object> parms = new Dictionary<string,object>();
if (name != null)
{
query += ", Name = ?name ";
parms.Add("?name", name);
}
if (description != null)
{
query += ", Description = ?description ";
parms.Add("?description", description);
}
if (title != null)
{
query += ", Title = ?title ";
parms.Add("?title", title);
}
query += ", Powers = ?powers ";
parms.Add("?powers", powers);
query += " WHERE GroupID = ?groupID AND RoleID = ?roleID";
parms.Add("?groupID", groupID);
parms.Add("?roleID", roleID);
using (ISimpleDB db = GetConnection())
{
if (db != null)
db.QueryNoResults(query, parms);
}
}
示例4: GetAgentGroupRoles
public List<OpenSim.Framework.GroupRolesData> GetAgentGroupRoles(GroupRequestID requestID, OpenMetaverse.UUID AgentID, OpenMetaverse.UUID GroupID)
{
List<OpenSim.Framework.GroupRolesData> foundGroupRoles = new List<OpenSim.Framework.GroupRolesData>();
using (ISimpleDB db = GetConnection())
{
if (db == null)
return foundGroupRoles;
string query
= " SELECT osrole.RoleID, osrole.GroupID, osrole.Title, osrole.Name, osrole.Description, osrole.Powers" +
" , CASE WHEN osgroupmembership.SelectedRoleID = osrole.RoleID THEN 1 ELSE 0 END AS Selected" +
" FROM osgroupmembership " +
" JOIN osgrouprolemembership ON (osgroupmembership.GroupID = osgrouprolemembership.GroupID AND osgroupmembership.AgentID = osgrouprolemembership.AgentID)" +
" JOIN osrole ON ( osgrouprolemembership.RoleID = osrole.RoleID AND osgrouprolemembership.GroupID = osrole.GroupID)" +
" LEFT JOIN osagent ON (osagent.AgentID = osgroupmembership.AgentID)" +
" WHERE osgroupmembership.AgentID = ?agentID ";
Dictionary<string, object> parms = new Dictionary<string, object>();
parms.Add("?agentID", AgentID);
if (GroupID != UUID.Zero)
{
query += " AND osgroupmembership.GroupID = ?groupID ";
parms.Add("?groupID", GroupID);
}
List<Dictionary<string, string>> results = db.QueryWithResults(query, parms);
foreach (Dictionary<string, string> result in results)
{
foundGroupRoles.Add(this.MapGroupRolesDataFromResult(result));
}
}
return foundGroupRoles;
}
示例5: AddGroupRole
public void AddGroupRole(GroupRequestID requestID, OpenMetaverse.UUID groupID, OpenMetaverse.UUID roleID, string name,
string description, string title, ulong powers, bool skipPermissionTests)
{
if (!skipPermissionTests)
{
if (!TestForPower(requestID, requestID.AgentID, groupID, (ulong)GroupPowers.CreateRole))
{
m_log.WarnFormat("[GROUPS]: {0} No permission to add group roles", requestID.AgentID);
return;
}
}
using (ISimpleDB db = GetConnection())
{
if (db == null)
return;
string query
= "INSERT INTO osrole (GroupID, RoleID, Name, Description, Title, Powers) " +
"VALUES(?groupID, ?roleID, ?name, ?desc, ?title, ?powers)";
Dictionary<string, object> parms = new Dictionary<string, object>();
parms.Add("?groupID", groupID);
parms.Add("?roleID", roleID);
parms.Add("?name", name);
parms.Add("?desc", description);
parms.Add("?title", title);
parms.Add("?powers", powers);
db.QueryNoResults(query, parms);
}
}
示例6: RemoveAgentFromGroup
public int RemoveAgentFromGroup(GroupRequestID requestID, OpenMetaverse.UUID RequesterID, OpenMetaverse.UUID AgentID, OpenMetaverse.UUID GroupID)
{
// Extra check needed for group owner removals - cannot remove the Owner role unless you are the user
GroupRecord groupRec = GetGroupRecord(requestID, GroupID, null);
if (groupRec == null) return (int)Constants.GenericReturnCodes.PARAMETER;
// Is this the last owner in a group? Don't let group managers shoot themselves in the foot.
List<UUID> groupOwners = GetGroupMembersWithRole(requestID, GroupID, groupRec.OwnerRoleID);
if (groupOwners.Contains(AgentID))
{
// Sorry Dave, I can't allow you to remove yourself if you are the only owner.
if (groupOwners.Count < 2)
{
m_log.WarnFormat("[GROUPS]: {0} Cannot remove the only owner {1} in group {2}", RequesterID, AgentID, GroupID);
return (int)Constants.GenericReturnCodes.PERMISSION;
}
// An owner can only be removed by themselves...
if (RequesterID != AgentID)
{
m_log.WarnFormat("[GROUPS]: {0} Cannot remove owner {1} of group {2}", RequesterID, AgentID, GroupID);
return (int)Constants.GenericReturnCodes.PERMISSION;
}
}
//user can always remove themselves from a group so skip tests in that case
if (RequesterID != AgentID)
{
if (!this.TestForPower(requestID, RequesterID, GroupID, (ulong)GroupPowers.Eject))
{
m_log.WarnFormat("[GROUPS]: {0} No permission to remove {1} from group {2}", RequesterID, AgentID, GroupID);
return (int)Constants.GenericReturnCodes.PERMISSION;
}
}
using (ISimpleDB db = GetConnection())
{
if (db == null)
return (int)Constants.GenericReturnCodes.ERROR;
if (!IsAgentMemberOfGroup(db, AgentID, GroupID))
{
m_log.WarnFormat("[GROUPS]: {0} Cannot remove non-member {1} from group {2}", requestID.AgentID, AgentID, GroupID);
return (int)Constants.GenericReturnCodes.PERMISSION;
}
string query = " UPDATE osagent " +
" SET ActiveGroupID = '" + UUID.Zero.ToString() + "' " +
" WHERE AgentID = ?agentID AND ActiveGroupID = ?groupID";
Dictionary<string, object> parms = new Dictionary<string,object>();
parms.Add("?agentID", AgentID);
parms.Add("?groupID", GroupID);
db.QueryNoResults(query, parms);
query = " DELETE FROM osgroupmembership " +
" WHERE AgentID = ?agentID AND GroupID = ?groupID";
db.QueryNoResults(query, parms);
query = " DELETE FROM osgrouprolemembership " +
" WHERE AgentID = ?agentID AND GroupID = ?groupID";
db.QueryNoResults(query, parms);
}
return (int)Constants.GenericReturnCodes.SUCCESS;
}
示例7: GetAgentActiveMembership
public OpenSim.Framework.GroupMembershipData GetAgentActiveMembership(GroupRequestID requestID, OpenMetaverse.UUID AgentID)
{
using (ISimpleDB db = GetConnection())
{
if (db == null)
return null;
string query
= " SELECT osgroup.GroupID, osgroup.Name as GroupName, osgroup.Charter, osgroup.InsigniaID, " +
"osgroup.FounderID, osgroup.MembershipFee, osgroup.OpenEnrollment, osgroup.ShowInList, " +
"osgroup.AllowPublish, osgroup.MaturePublish, osgroupmembership.Contribution, " +
"osgroupmembership.ListInProfile, osgroupmembership.AcceptNotices, osgroupmembership.SelectedRoleID, osrole.Title" +
" , osagent.ActiveGroupID " +
" FROM osagent JOIN osgroup ON (osgroup.GroupID = osagent.ActiveGroupID)" +
" JOIN osgroupmembership ON (osgroup.GroupID = osgroupmembership.GroupID AND osagent.AgentID = osgroupmembership.AgentID)" +
" JOIN osrole ON (osgroupmembership.SelectedRoleID = osrole.RoleID AND osgroupmembership.GroupID = osrole.GroupID)" +
" WHERE osagent.AgentID = ?agentID";
Dictionary<string, object> parms = new Dictionary<string, object>();
parms.Add("?agentID", AgentID);
List<Dictionary<string, string>> groupResults = db.QueryWithResults(query, parms);
if (groupResults.Count == 0)
{
//no active group? no groups, etc
return null;
}
UUID groupID = new UUID(groupResults[0]["GroupID"]);
Dictionary<string, string> powersResult = FindGroupPowersForAgent(db, groupID, AgentID);
OpenSim.Framework.GroupMembershipData foundMembership
= this.MapGroupMembershipDataFromResult(groupResults[0], powersResult);
return foundMembership;
}
}
示例8: GetGroupMembersWithRole
public List<UUID> GetGroupMembersWithRole(GroupRequestID requestID, UUID GroupID, UUID RoleID)
{
string query = " SELECT * FROM osgrouprolemembership WHERE GroupID = ?groupID AND RoleID = ?roleID";
Dictionary<string, object> parms = new Dictionary<string, object>();
parms.Add("?groupID", GroupID);
parms.Add("?roleID", RoleID);
List<UUID> roleMembersData = new List<UUID>();
using (ISimpleDB db = GetConnection())
{
if (db == null)
return roleMembersData;
List<Dictionary<string, string>> results = db.QueryWithResults(query, parms);
foreach (Dictionary<string, string> result in results)
roleMembersData.Add(new UUID(result["AgentID"]));
}
return roleMembersData;
}
示例9: AgentCanJoinGroup
private bool AgentCanJoinGroup(GroupRequestID requestID, OpenMetaverse.UUID AgentID, OpenMetaverse.UUID GroupID, OpenMetaverse.UUID RoleID)
{
GroupRecord record = GetGroupRecord(requestID, GroupID, null);
if (record == null)
{
return false;
}
//is the group open enrollment?
if (record.OpenEnrollment && RoleID == EVERYONE_ROLEID)
{
return true;
}
//has the agent been invited?
if (this.AgentHasBeenInvitedToGroup(AgentID, GroupID, RoleID))
{
return true;
}
//no way, agent can't join
return false;
}
示例10: AddGroupNotice
public bool AddGroupNotice(GroupRequestID requestID, OpenMetaverse.UUID groupID, OpenMetaverse.UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket)
{
if (!this.TestForPower(requestID, requestID.AgentID, groupID, (ulong)GroupPowers.SendNotices))
{
m_log.WarnFormat("[GROUPS]: {0} No permission to send notices for group {1}", requestID.AgentID, groupID);
return false;
}
using (ISimpleDB db = GetConnection())
{
if (db == null)
return false;
string binBucketString = OpenMetaverse.Utils.BytesToHexString(binaryBucket, "");
string query = " INSERT INTO osgroupnotice" +
" (GroupID, NoticeID, Timestamp, FromName, Subject, Message, BinaryBucket)" +
" VALUES " +
" (?groupID, ?noticeID, ?timeStamp, ?fromName, ?subject, ?message, ?binaryBucket)";
Dictionary<string, object> parms = new Dictionary<string, object>();
parms.Add("?groupID", groupID);
parms.Add("?noticeID", noticeID);
parms.Add("?timeStamp", ((uint)Util.UnixTimeSinceEpoch()).ToString());
parms.Add("?fromName", fromName);
parms.Add("?subject", subject);
parms.Add("?message", message);
parms.Add("?binaryBucket", binBucketString);
db.QueryNoResults(query, parms);
}
return true;
}
示例11: GetGroupNotice
// WARNING: This method does not initialize all notice fields, namely the fields stored in the binary bucket.
// See FlexiGroups.cs method InitializeNoticeFromBucket() for an example.
public GroupNoticeInfo GetGroupNotice(GroupRequestID requestID, OpenMetaverse.UUID noticeID)
{
using (ISimpleDB db = GetConnection())
{
if (db == null)
return null;
string query
= " SELECT GroupID, NoticeID, Timestamp, FromName, Subject, Message, BinaryBucket" +
" FROM osgroupnotice" +
" WHERE osgroupnotice.NoticeID = ?noticeID";
Dictionary<string, object> parms = new Dictionary<string, object>();
parms.Add("?noticeID", noticeID);
List<Dictionary<string, string>> results = db.QueryWithResults(query, parms);
if (results.Count == 0)
{
return null;
}
else
{
return this.MapGroupNoticeFromResult(results[0]);
}
}
}
示例12: TestForPower
bool TestForPower(GroupRequestID requestID, OpenMetaverse.UUID agentID, OpenMetaverse.UUID groupID, ulong power)
{
GroupMembershipData membershipData = GetAgentGroupMembership(requestID, agentID, groupID);
if (membershipData == null)
{
return false;
}
if ((membershipData.GroupPowers & power) == 0)
{
return false;
}
return true;
}
示例13: GetAgentGroupMemberships
public List<OpenSim.Framework.GroupMembershipData> GetAgentGroupMemberships(GroupRequestID requestID, OpenMetaverse.UUID AgentID)
{
using (ISimpleDB db = GetConnection())
{
if (db == null)
return new List<OpenSim.Framework.GroupMembershipData>();
string query = " SELECT osgroup.GroupID, osgroup.Name as GroupName, osgroup.Charter, osgroup.InsigniaID, osgroup.FounderID, osgroup.MembershipFee, osgroup.OpenEnrollment, osgroup.ShowInList, osgroup.AllowPublish, osgroup.MaturePublish" +
" , osgroupmembership.Contribution, osgroupmembership.ListInProfile, osgroupmembership.AcceptNotices" +
" , osgroupmembership.SelectedRoleID, osrole.Title" +
" , IFNULL(osagent.ActiveGroupID, '" + UUID.Zero + "') AS ActiveGroupID" +
" FROM osgroup JOIN osgroupmembership ON (osgroup.GroupID = osgroupmembership.GroupID)" +
" JOIN osrole ON (osgroupmembership.SelectedRoleID = osrole.RoleID AND osgroupmembership.GroupID = osrole.GroupID)" +
" LEFT JOIN osagent ON (osagent.AgentID = osgroupmembership.AgentID)" +
" WHERE osgroupmembership.AgentID = ?agentID";
Dictionary<string, object> parms = new Dictionary<string, object>();
parms.Add("?agentID", AgentID);
List<Dictionary<string, string>> results = db.QueryWithResults(query, parms);
//map the group data first into a dict so that it'll be easy to search to fill
//the group powers
Dictionary<string, OpenSim.Framework.GroupMembershipData> membershipData = new Dictionary<string, OpenSim.Framework.GroupMembershipData>();
foreach (Dictionary<string, string> result in results)
{
membershipData.Add(result["GroupID"], this.MapGroupMembershipDataFromResult(result, null));
}
//now, assign the group powers returned
query = " SELECT BIT_OR(osrole.Powers) AS GroupPowers, osgrouprolemembership.GroupID" +
" FROM osgrouprolemembership JOIN osrole ON (osgrouprolemembership.GroupID = osrole.GroupID AND osgrouprolemembership.RoleID = osrole.RoleID)" +
" WHERE osgrouprolemembership.AgentID = ?agentID " +
" GROUP BY GroupID ";
results = db.QueryWithResults(query, parms);
foreach (Dictionary<string, string> result in results)
{
if (result.ContainsKey("GroupID") && membershipData.ContainsKey(result["GroupID"]))
{
OpenSim.Framework.GroupMembershipData currMembershipData = membershipData[result["GroupID"]];
currMembershipData.GroupPowers = ulong.Parse(result["GroupPowers"]);
}
}
return new List<OpenSim.Framework.GroupMembershipData>(membershipData.Values);
}
}
示例14: GetAgentGroupMembership
public OpenSim.Framework.GroupMembershipData GetAgentGroupMembership(GroupRequestID requestID, OpenMetaverse.UUID AgentID, OpenMetaverse.UUID GroupID)
{
//TODO? Refactor? This is very similar to another method, just different params and queries
using (ISimpleDB db = GetConnection())
{
if (db == null)
return null;
string query
= " SELECT osgroup.GroupID, osgroup.Name as GroupName, osgroup.Charter, osgroup.InsigniaID, " +
"osgroup.FounderID, osgroup.MembershipFee, osgroup.OpenEnrollment, osgroup.ShowInList, " +
"osgroup.AllowPublish, osgroup.MaturePublish, osgroupmembership.Contribution, " +
"osgroupmembership.ListInProfile, osgroupmembership.AcceptNotices, " +
"osgroupmembership.SelectedRoleID, osrole.Title" +
" FROM osgroup JOIN osgroupmembership ON (osgroup.GroupID = osgroupmembership.GroupID)" +
" JOIN osrole ON (osgroupmembership.SelectedRoleID = osrole.RoleID AND osgroupmembership.GroupID = osrole.GroupID)" +
" WHERE osgroup.GroupID = ?groupID AND osgroupmembership.AgentID = ?agentID";
Dictionary<string, object> parms = new Dictionary<string, object>();
parms.Add("?groupID", GroupID);
parms.Add("?agentID", AgentID);
List<Dictionary<string, string>> groupResults = db.QueryWithResults(query, parms);
if (groupResults.Count == 0)
{
// no groups, etc?
return null;
}
Dictionary<string, string> powersResult = FindGroupPowersForAgent(db, GroupID, AgentID);
OpenSim.Framework.GroupMembershipData foundMembership
= this.MapGroupMembershipDataFromResult(groupResults[0], powersResult);
return foundMembership;
}
}
示例15: SetAgentGroupInfo
public void SetAgentGroupInfo(GroupRequestID requestID, OpenMetaverse.UUID AgentID, OpenMetaverse.UUID GroupID, bool AcceptNotices, bool ListInProfile)
{
//the agent making the reuqest must be the target agent
if (requestID.AgentID != AgentID)
{
m_log.WarnFormat("[GROUPS]: {0} No permission to change group info for {1}", requestID.AgentID, AgentID);
return;
}
string query =
"UPDATE osgroupmembership " +
"SET AcceptNotices = ?acceptNotices, " +
"ListInProfile = ?listInProfile " +
"WHERE osgroupmembership.GroupID = ?groupID " +
"AND osgroupmembership.AgentID = ?agentID ";
Dictionary<string, object> parms = new Dictionary<string, object>();
parms.Add("?acceptNotices", AcceptNotices);
parms.Add("?listInProfile", ListInProfile);
parms.Add("?groupID", GroupID);
parms.Add("?agentID", AgentID);
using (ISimpleDB db = GetConnection())
{
if (db != null)
db.QueryNoResults(query, parms);
}
}