* Permissions! - You can now only perform certain functions (such as editing other peoples objects) if you have permission to do so.
* Moved OnPermissionError to EventManager - now triggers a standard blue alert. * Terraforming now requires permission via the permissions manager. [Defaults to admin-only] * Permissions manager is now substantiated in Scene * Buttload of new permissions added. * Estate manager operations now require various levels of permission to operate * OGS1 now produces 'summary reports' for a commsManager of each scene it maintains connections for. Reduces grid network traffic for ping checks. * Added new "permissions true" / "permissions false" console command to enable or disable permissions.afrisby
parent
a4fc02d790
commit
5699bb2e64
|
@ -320,6 +320,17 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "permissions":
|
||||||
|
// Treats each user as a super-admin when disabled
|
||||||
|
foreach (Scene scene in m_localScenes)
|
||||||
|
{
|
||||||
|
if (Convert.ToBoolean(cmdparams[0]))
|
||||||
|
scene.PermissionsMngr.EnablePermissions();
|
||||||
|
else
|
||||||
|
scene.PermissionsMngr.DisablePermissions();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case "backup":
|
case "backup":
|
||||||
foreach (Scene scene in m_localScenes)
|
foreach (Scene scene in m_localScenes)
|
||||||
{
|
{
|
||||||
|
|
|
@ -260,6 +260,16 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
Hashtable respData = new Hashtable();
|
Hashtable respData = new Hashtable();
|
||||||
respData["online"] = "true";
|
respData["online"] = "true";
|
||||||
|
|
||||||
|
foreach (ulong region in this.listeners.Keys)
|
||||||
|
{
|
||||||
|
Hashtable regData = new Hashtable();
|
||||||
|
RegionInfo reg = regions[region];
|
||||||
|
regData["status"] = "active";
|
||||||
|
regData["handle"] = region.ToString();
|
||||||
|
|
||||||
|
respData[reg.SimUUID.ToStringHyphenated()] = regData;
|
||||||
|
}
|
||||||
|
|
||||||
response.Value = respData;
|
response.Value = respData;
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
|
|
@ -147,35 +147,37 @@ namespace OpenSim.Region.Environment
|
||||||
|
|
||||||
public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, IClientAPI remote_client)
|
public void handleEstateOwnerMessage(EstateOwnerMessagePacket packet, IClientAPI remote_client)
|
||||||
{
|
{
|
||||||
if (remote_client.AgentId == m_regInfo.MasterAvatarAssignedUUID)
|
switch (Helpers.FieldToUTF8String(packet.MethodData.Method))
|
||||||
{
|
{
|
||||||
switch (Helpers.FieldToUTF8String(packet.MethodData.Method))
|
case "getinfo":
|
||||||
{
|
this.sendRegionInfoPacketToAll();
|
||||||
case "getinfo":
|
break;
|
||||||
this.sendRegionInfoPacketToAll();
|
case "setregioninfo":
|
||||||
break;
|
if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId))
|
||||||
case "setregioninfo":
|
|
||||||
estateSetRegionInfoHandler(packet);
|
estateSetRegionInfoHandler(packet);
|
||||||
break;
|
break;
|
||||||
case "texturebase":
|
case "texturebase":
|
||||||
|
if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId))
|
||||||
estateTextureBaseHandler(packet);
|
estateTextureBaseHandler(packet);
|
||||||
break;
|
break;
|
||||||
case "texturedetail":
|
case "texturedetail":
|
||||||
|
if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId))
|
||||||
estateTextureDetailHandler(packet);
|
estateTextureDetailHandler(packet);
|
||||||
break;
|
break;
|
||||||
case "textureheights":
|
case "textureheights":
|
||||||
|
if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId))
|
||||||
estateTextureHeightsHandler(packet);
|
estateTextureHeightsHandler(packet);
|
||||||
break;
|
break;
|
||||||
case "texturecommit":
|
case "texturecommit":
|
||||||
sendRegionHandshakeToAll();
|
sendRegionHandshakeToAll();
|
||||||
break;
|
break;
|
||||||
case "setregionterrain":
|
case "setregionterrain":
|
||||||
|
if (m_scene.PermissionsMngr.CanEditEstateTerrain(remote_client.AgentId))
|
||||||
estateSetRegionTerrainHandler(packet);
|
estateSetRegionTerrainHandler(packet);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MainLog.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString());
|
MainLog.Instance.Error("EstateOwnerMessage: Unknown method requested\n" + packet.ToString());
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,36 +15,80 @@ namespace OpenSim.Region.Environment
|
||||||
{
|
{
|
||||||
protected Scene m_scene;
|
protected Scene m_scene;
|
||||||
|
|
||||||
|
// Bypasses the permissions engine (always returns OK)
|
||||||
|
// disable in any production environment
|
||||||
|
// TODO: Change this to false when permissions are a desired default
|
||||||
|
// TODO: Move to configuration option.
|
||||||
|
private bool bypassPermissions = true;
|
||||||
|
|
||||||
public PermissionManager(Scene scene)
|
public PermissionManager(Scene scene)
|
||||||
{
|
{
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
public delegate void OnPermissionErrorDelegate(LLUUID user, string reason);
|
public void DisablePermissions()
|
||||||
public event OnPermissionErrorDelegate OnPermissionError;
|
{
|
||||||
|
bypassPermissions = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EnablePermissions()
|
||||||
|
{
|
||||||
|
bypassPermissions = false;
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual void SendPermissionError(LLUUID user, string reason)
|
protected virtual void SendPermissionError(LLUUID user, string reason)
|
||||||
{
|
{
|
||||||
if (OnPermissionError != null)
|
m_scene.EventManager.TriggerPermissionError(user, reason);
|
||||||
OnPermissionError(user, reason);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual bool IsAdministrator(LLUUID user)
|
protected virtual bool IsAdministrator(LLUUID user)
|
||||||
{
|
{
|
||||||
|
if (bypassPermissions)
|
||||||
|
return bypassPermissions;
|
||||||
|
|
||||||
return m_scene.RegionInfo.MasterAvatarAssignedUUID == user;
|
return m_scene.RegionInfo.MasterAvatarAssignedUUID == user;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual bool IsEstateManager(LLUUID user)
|
protected virtual bool IsEstateManager(LLUUID user)
|
||||||
|
{
|
||||||
|
if (bypassPermissions)
|
||||||
|
return bypassPermissions;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual bool IsGridUser(LLUUID user)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual bool IsGuest(LLUUID user)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool CanRezObject(LLUUID user, LLVector3 position)
|
public virtual bool CanRezObject(LLUUID user, LLVector3 position)
|
||||||
{
|
{
|
||||||
|
bool permission = false;
|
||||||
|
|
||||||
|
string reason = "Insufficient permission";
|
||||||
|
|
||||||
|
if (IsAdministrator(user))
|
||||||
|
permission = true;
|
||||||
|
else
|
||||||
|
reason = "Not an administrator";
|
||||||
|
|
||||||
|
if (GenericParcelPermission(user, position))
|
||||||
|
permission = true;
|
||||||
|
else
|
||||||
|
reason = "Not the parcel owner";
|
||||||
|
|
||||||
|
if (!permission)
|
||||||
|
SendPermissionError(user, reason);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#region Object Permissions
|
#region Object Permissions
|
||||||
|
|
||||||
protected virtual bool GenericObjectPermission(LLUUID user, LLUUID obj)
|
protected virtual bool GenericObjectPermission(LLUUID user, LLUUID obj)
|
||||||
|
@ -105,19 +149,71 @@ namespace OpenSim.Region.Environment
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Communication Permissions
|
||||||
|
|
||||||
|
public virtual bool GenericCommunicationPermission(LLUUID user, LLUUID target)
|
||||||
|
{
|
||||||
|
bool permission = false;
|
||||||
|
string reason = "Only registered users may communicate with another account.";
|
||||||
|
|
||||||
|
if (IsGridUser(user))
|
||||||
|
permission = true;
|
||||||
|
|
||||||
|
if (!IsGridUser(user))
|
||||||
|
{
|
||||||
|
permission = false;
|
||||||
|
reason = "The person that you are messaging is not a registered user.";
|
||||||
|
}
|
||||||
|
if (IsAdministrator(user))
|
||||||
|
permission = true;
|
||||||
|
|
||||||
|
if (IsEstateManager(user))
|
||||||
|
permission = true;
|
||||||
|
|
||||||
|
if (!permission)
|
||||||
|
SendPermissionError(user, reason);
|
||||||
|
|
||||||
|
return permission;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool CanInstantMessage(LLUUID user, LLUUID target)
|
||||||
|
{
|
||||||
|
return GenericCommunicationPermission(user, target);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool CanInventoryTransfer(LLUUID user, LLUUID target)
|
||||||
|
{
|
||||||
|
return GenericCommunicationPermission(user, target);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
public virtual bool CanEditScript(LLUUID user, LLUUID script)
|
public virtual bool CanEditScript(LLUUID user, LLUUID script)
|
||||||
{
|
{
|
||||||
return false;
|
return IsAdministrator(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool CanRunScript(LLUUID user, LLUUID script)
|
public virtual bool CanRunScript(LLUUID user, LLUUID script)
|
||||||
{
|
{
|
||||||
return false;
|
return IsAdministrator(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool CanTerraform(LLUUID user, LLUUID position)
|
public virtual bool CanTerraform(LLUUID user, LLVector3 position)
|
||||||
{
|
{
|
||||||
return false;
|
bool permission = false;
|
||||||
|
|
||||||
|
// Estate override
|
||||||
|
if (GenericEstatePermission(user))
|
||||||
|
permission = true;
|
||||||
|
|
||||||
|
// Land owner can terraform too
|
||||||
|
if (GenericParcelPermission(user, m_scene.LandManager.getLandObject(position.X, position.Y)))
|
||||||
|
permission = true;
|
||||||
|
|
||||||
|
if (!permission)
|
||||||
|
SendPermissionError(user, "Not authorized to terraform at this location.");
|
||||||
|
|
||||||
|
return permission;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Estate Permissions
|
#region Estate Permissions
|
||||||
|
@ -168,6 +264,11 @@ namespace OpenSim.Region.Environment
|
||||||
return permission;
|
return permission;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual bool GenericParcelPermission(LLUUID user, LLVector3 pos)
|
||||||
|
{
|
||||||
|
return GenericParcelPermission(user, m_scene.LandManager.getLandObject(pos.X, pos.Y));
|
||||||
|
}
|
||||||
|
|
||||||
public virtual bool CanEditParcel(LLUUID user, Land parcel)
|
public virtual bool CanEditParcel(LLUUID user, Land parcel)
|
||||||
{
|
{
|
||||||
return GenericParcelPermission(user, parcel);
|
return GenericParcelPermission(user, parcel);
|
||||||
|
|
|
@ -50,6 +50,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="west">Distance from the west border where the cursor is located</param>
|
/// <param name="west">Distance from the west border where the cursor is located</param>
|
||||||
public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, IClientAPI remoteUser)
|
public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, IClientAPI remoteUser)
|
||||||
{
|
{
|
||||||
|
// Do a permissions check before allowing terraforming.
|
||||||
|
// random users are now no longer allowed to terraform
|
||||||
|
// if permissions are enabled.
|
||||||
|
if (!PermissionsMngr.CanTerraform(remoteUser.AgentId, new LLVector3(north, west, 0)))
|
||||||
|
return;
|
||||||
|
|
||||||
// Shiny.
|
// Shiny.
|
||||||
double size = (double)(1 << brushsize);
|
double size = (double)(1 << brushsize);
|
||||||
|
|
||||||
|
@ -240,15 +246,18 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
if (selectedEnt != null)
|
if (selectedEnt != null)
|
||||||
{
|
{
|
||||||
List<ScenePresence> avatars = this.RequestAvatarList();
|
if (PermissionsMngr.CanDeRezObject(simClient.AgentId, selectedEnt.m_uuid))
|
||||||
foreach (ScenePresence avatar in avatars)
|
|
||||||
{
|
{
|
||||||
avatar.ControllingClient.SendKillObject(this.m_regionHandle, selectedEnt.LocalId);
|
List<ScenePresence> avatars = this.RequestAvatarList();
|
||||||
}
|
foreach (ScenePresence avatar in avatars)
|
||||||
|
{
|
||||||
lock (Entities)
|
avatar.ControllingClient.SendKillObject(this.m_regionHandle, selectedEnt.LocalId);
|
||||||
{
|
}
|
||||||
Entities.Remove(selectedEnt.m_uuid);
|
|
||||||
|
lock (Entities)
|
||||||
|
{
|
||||||
|
Entities.Remove(selectedEnt.m_uuid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -501,16 +510,19 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
|
public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
bool hasPrim = false;
|
if (PermissionsMngr.CanEditObject(remoteClient.AgentId, objectID))
|
||||||
foreach (EntityBase ent in Entities.Values)
|
|
||||||
{
|
{
|
||||||
if (ent is SceneObjectGroup)
|
bool hasPrim = false;
|
||||||
|
foreach (EntityBase ent in Entities.Values)
|
||||||
{
|
{
|
||||||
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(objectID);
|
if (ent is SceneObjectGroup)
|
||||||
if (hasPrim != false)
|
|
||||||
{
|
{
|
||||||
((SceneObjectGroup)ent).GrabMovement(offset, pos, remoteClient);
|
hasPrim = ((SceneObjectGroup)ent).HasChildPrim(objectID);
|
||||||
break;
|
if (hasPrim != false)
|
||||||
|
{
|
||||||
|
((SceneObjectGroup)ent).GrabMovement(offset, pos, remoteClient);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,6 +110,13 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
get { return m_scriptManager; }
|
get { return m_scriptManager; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private PermissionManager m_permissionManager;
|
||||||
|
|
||||||
|
public PermissionManager PermissionsMngr
|
||||||
|
{
|
||||||
|
get { return m_permissionManager; }
|
||||||
|
}
|
||||||
|
|
||||||
public Dictionary<LLUUID, SceneObjectGroup> Objects
|
public Dictionary<LLUUID, SceneObjectGroup> Objects
|
||||||
{
|
{
|
||||||
get { return Prims; }
|
get { return Prims; }
|
||||||
|
@ -143,10 +150,13 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
m_estateManager = new EstateManager(this, m_regInfo);
|
m_estateManager = new EstateManager(this, m_regInfo);
|
||||||
m_scriptManager = new ScriptManager(this);
|
m_scriptManager = new ScriptManager(this);
|
||||||
m_eventManager = new EventManager();
|
m_eventManager = new EventManager();
|
||||||
|
m_permissionManager = new PermissionManager(this);
|
||||||
|
|
||||||
m_eventManager.OnParcelPrimCountAdd +=
|
m_eventManager.OnParcelPrimCountAdd +=
|
||||||
m_LandManager.addPrimToLandPrimCounts;
|
m_LandManager.addPrimToLandPrimCounts;
|
||||||
|
|
||||||
|
m_eventManager.OnPermissionError += SendPermissionAlert;
|
||||||
|
|
||||||
MainLog.Instance.Verbose("Creating new entitities instance");
|
MainLog.Instance.Verbose("Creating new entitities instance");
|
||||||
Entities = new Dictionary<LLUUID, EntityBase>();
|
Entities = new Dictionary<LLUUID, EntityBase>();
|
||||||
Avatars = new Dictionary<LLUUID, ScenePresence>();
|
Avatars = new Dictionary<LLUUID, ScenePresence>();
|
||||||
|
@ -966,6 +976,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Alert Methods
|
#region Alert Methods
|
||||||
|
|
||||||
|
void SendPermissionAlert(LLUUID user, string reason)
|
||||||
|
{
|
||||||
|
SendAlertToUser(user, reason, false);
|
||||||
|
}
|
||||||
|
|
||||||
public void SendGeneralAlert(string message)
|
public void SendGeneralAlert(string message)
|
||||||
{
|
{
|
||||||
foreach (ScenePresence presence in this.Avatars.Values)
|
foreach (ScenePresence presence in this.Avatars.Values)
|
||||||
|
|
|
@ -33,7 +33,16 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public event OnShutdownDelegate OnShutdown;
|
public event OnShutdownDelegate OnShutdown;
|
||||||
|
|
||||||
public delegate void ObjectGrabDelegate(uint localID, LLVector3 offsetPos, IClientAPI remoteClient);
|
public delegate void ObjectGrabDelegate(uint localID, LLVector3 offsetPos, IClientAPI remoteClient);
|
||||||
|
public delegate void OnPermissionErrorDelegate(LLUUID user, string reason);
|
||||||
public event ObjectGrabDelegate OnObjectGrab;
|
public event ObjectGrabDelegate OnObjectGrab;
|
||||||
|
public event OnPermissionErrorDelegate OnPermissionError;
|
||||||
|
|
||||||
|
|
||||||
|
public void TriggerPermissionError(LLUUID user, string reason)
|
||||||
|
{
|
||||||
|
if (OnPermissionError != null)
|
||||||
|
OnPermissionError(user, reason);
|
||||||
|
}
|
||||||
|
|
||||||
public void TriggerOnScriptConsole(string[] args)
|
public void TriggerOnScriptConsole(string[] args)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue