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/Api/Implementation') 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 ++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation') 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 -- cgit v1.1