From 7223b63563f28f6fe8044bdabcd1b9900d28c54a Mon Sep 17 00:00:00 2001
From: Snoopy Pfeffer
Date: Tue, 27 Mar 2012 22:09:58 +0200
Subject: User level based restrictions for HyperGrid teleports, asset uploads,
group creations and getting contacted from other grids. Incoming HyperGrid
teleports can also be restricted to local users.
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 +++
1 file changed, 3 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine/Shared')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index d7a629b..7455929 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4151,6 +4151,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case 4: // DATA_RATING (0,0,0,0,0,0)
reply = "0,0,0,0,0,0";
break;
+ case 7: // DATA_USERLEVEL (integer)
+ reply = account.UserLevel.ToString();
+ break;
case 8: // DATA_PAYINFO (0|1|2|3)
reply = "0";
break;
--
cgit v1.1
From 19837ff4dd8b01cf1f0a458cafc02c56be48bf66 Mon Sep 17 00:00:00 2001
From: Snoopy Pfeffer
Date: Tue, 27 Mar 2012 22:30:02 +0200
Subject: Two new scripting functions osInviteToGroup(userID) and
osEjectFromGroup(userID) that invite/eject users to/from groups the object
containing the script is set to. These functions also work for closed groups.
---
.../Shared/Api/Implementation/OSSL_Api.cs | 69 ++++++++++++++++++++++
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 3 +
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 10 ++++
3 files changed, 82 insertions(+)
(limited to 'OpenSim/Region/ScriptEngine/Shared')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 2ecd890..a5dcba4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2980,5 +2980,74 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return String.Empty;
}
+
+ ///
+ /// Invite user to the group this object is set to
+ ///
+ ///
+ ///
+ public LSL_Integer osInviteToGroup(LSL_Key agentId)
+ {
+ CheckThreatLevel(ThreatLevel.VeryLow, "osInviteToGroup");
+ m_host.AddScriptLPS(1);
+
+ UUID agent = new UUID(agentId);
+
+ // groups module is required
+ IGroupsModule groupsModule = m_ScriptEngine.World.RequestModuleInterface();
+ if (groupsModule == null) return ScriptBaseClass.FALSE;
+
+ // object has to be set to a group, but not group owned
+ if (m_host.GroupID == UUID.Zero || m_host.GroupID == m_host.OwnerID) return ScriptBaseClass.FALSE;
+
+ // object owner has to be in that group and required permissions
+ GroupMembershipData member = groupsModule.GetMembershipData(m_host.GroupID, m_host.OwnerID);
+ if (member == null || (member.GroupPowers & (ulong)GroupPowers.Invite) == 0) return ScriptBaseClass.FALSE;
+
+ // check if agent is in that group already
+ //member = groupsModule.GetMembershipData(agent, m_host.GroupID, agent);
+ //if (member != null) return ScriptBaseClass.FALSE;
+
+ // invited agent has to be present in this scene
+ if (World.GetScenePresence(agent) == null) return ScriptBaseClass.FALSE;
+
+ groupsModule.InviteGroup(null, m_host.OwnerID, m_host.GroupID, agent, UUID.Zero);
+
+ return ScriptBaseClass.TRUE;
+ }
+
+ ///
+ /// Eject user from the group this object is set to
+ ///
+ ///
+ ///
+ public LSL_Integer osEjectFromGroup(LSL_Key agentId)
+ {
+ CheckThreatLevel(ThreatLevel.VeryLow, "osEjectFromGroup");
+ m_host.AddScriptLPS(1);
+
+ UUID agent = new UUID(agentId);
+
+ // groups module is required
+ IGroupsModule groupsModule = m_ScriptEngine.World.RequestModuleInterface();
+ if (groupsModule == null) return ScriptBaseClass.FALSE;
+
+ // object has to be set to a group, but not group owned
+ if (m_host.GroupID == UUID.Zero || m_host.GroupID == m_host.OwnerID) return ScriptBaseClass.FALSE;
+
+ // object owner has to be in that group and required permissions
+ GroupMembershipData member = groupsModule.GetMembershipData(m_host.GroupID, m_host.OwnerID);
+ if (member == null || (member.GroupPowers & (ulong)GroupPowers.Eject) == 0) return ScriptBaseClass.FALSE;
+
+ // agent has to be in that group
+ //member = groupsModule.GetMembershipData(agent, m_host.GroupID, agent);
+ //if (member == null) return ScriptBaseClass.FALSE;
+
+ // ejectee can be offline
+
+ groupsModule.EjectGroupMember(null, m_host.OwnerID, m_host.GroupID, agent);
+
+ return ScriptBaseClass.TRUE;
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 8f9efc0..30bd3ef 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -231,5 +231,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_String osUnixTimeToTimestamp(long time);
LSL_String osGetInventoryDesc(string item);
+
+ LSL_Integer osInviteToGroup(LSL_Key agentId);
+ LSL_Integer osEjectFromGroup(LSL_Key agentId);
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 09e5992..680cefb4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -868,5 +868,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
return m_OSSL_Functions.osGetInventoryDesc(item);
}
+
+ public LSL_Integer osInviteToGroup(LSL_Key agentId)
+ {
+ return m_OSSL_Functions.osInviteToGroup(agentId);
+ }
+
+ public LSL_Integer osEjectFromGroup(LSL_Key agentId)
+ {
+ return m_OSSL_Functions.osEjectFromGroup(agentId);
+ }
}
}
--
cgit v1.1