mirror of
https://github.com/opensim/opensim.git
synced 2026-08-04 16:22:50 +08:00
Adding dynamic ossl permission control
Add permission by identifying uuid (owner/creator/group) and function. Revoke permission in the same manner. Permission adjustments immediately effect running scripts ability to call os functions. osGrantScriptPermissions(UUID key,string function) Threat Level Severe osRevokeScriptPermissions(UUID key,string function) Threat Level Severe work sponsored by: Rage
This commit is contained in:
@@ -264,6 +264,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
// or a string explaining why this function can't be used.
|
||||
private string CheckThreatLevelTest(ThreatLevel level, string function)
|
||||
{
|
||||
if(GetDynaPerms(m_item.CreatorID, m_item.OwnerID, m_item.GroupID, function))
|
||||
return string.Empty;
|
||||
|
||||
if (!m_FunctionPerms.ContainsKey(function))
|
||||
{
|
||||
FunctionPerms perms = new FunctionPerms();
|
||||
@@ -431,6 +434,47 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
System.Threading.Thread.Sleep(delay);
|
||||
}
|
||||
|
||||
private bool GetDynaPerms(UUID owner, UUID creator, UUID group, string function)
|
||||
{
|
||||
if (World.GetOsslPerms(owner, function))
|
||||
return true;
|
||||
if (World.GetOsslPerms(creator, function))
|
||||
return true;
|
||||
if (World.GetOsslPerms(creator, function))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public void osGrantScriptPermissions(LSL_Key avatar, LSL_List osfunctions)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.Severe, "osGrantScriptPermissions");
|
||||
m_host.AddScriptLPS(1);
|
||||
UUID key;
|
||||
UUID.TryParse(avatar.m_string, out key);
|
||||
|
||||
for (int item = 0; item <= osfunctions.Length - 1; item++)
|
||||
{
|
||||
string function = osfunctions.GetLSLStringItem(item);
|
||||
World.AddOsslPerm(key, function);
|
||||
}
|
||||
}
|
||||
|
||||
public void osRevokeScriptPermissions (LSL_Key avatar, LSL_List osfunctions)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.Severe, "osRevokeScriptPermissions");
|
||||
m_host.AddScriptLPS(1);
|
||||
UUID key;
|
||||
UUID.TryParse(avatar.m_string, out key);
|
||||
|
||||
for (int item = 0; item <= osfunctions.Length - 1; item++)
|
||||
{
|
||||
string function = osfunctions.GetLSLStringItem(item);
|
||||
World.RemoveOsslPerm(key, function);
|
||||
}
|
||||
}
|
||||
|
||||
public LSL_Integer osSetTerrainHeight(int x, int y, double val)
|
||||
{
|
||||
CheckThreatLevel(ThreatLevel.High, "osSetTerrainHeight");
|
||||
|
||||
@@ -116,6 +116,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
{
|
||||
void CheckThreatLevel(ThreatLevel level, string function);
|
||||
|
||||
// Scripted Script Permissions
|
||||
void osGrantScriptPermissions(LSL_Key avatar, LSL_List functions);
|
||||
void osRevokeScriptPermissions(LSL_Key avatar, LSL_List functions);
|
||||
|
||||
//OpenSim functions
|
||||
string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer);
|
||||
string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams,
|
||||
|
||||
@@ -61,6 +61,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
Prim = new OSSLPrim(this);
|
||||
}
|
||||
|
||||
public void osGrantScriptPermissions (LSL_Key avatar, LSL_List osfunctions)
|
||||
{
|
||||
m_OSSL_Functions.osGrantScriptPermissions(avatar, osfunctions);
|
||||
}
|
||||
|
||||
public void osRevokeScriptPermissions (LSL_Key avatar, LSL_List osfunctions)
|
||||
{
|
||||
m_OSSL_Functions.osRevokeScriptPermissions(avatar, osfunctions);
|
||||
}
|
||||
|
||||
public void osSetRegionWaterHeight(double height)
|
||||
{
|
||||
m_OSSL_Functions.osSetRegionWaterHeight(height);
|
||||
|
||||
Reference in New Issue
Block a user