* Committing Patch mantis 0001275: [PATCH] Add more perms-fu. From Melanie. Thanks Melanie!
* Adds hooks in the permission module for CanReadScript, CanEditScript, CanCopyInventory, CanDeleteInventory, CanEditNotecard, CanViewNotecard, CanViewScript.. and a few more. The functionality in the default module returns true.0.6.0-stable
parent
66e6711f3e
commit
bc177b1c37
|
@ -151,6 +151,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
|
|||
m_scene.ExternalChecks.addCheckEditObject(CanEditObject);//MAYBE FULLY IMPLEMENTED
|
||||
m_scene.ExternalChecks.addCheckEditParcel(CanEditParcel); //FULLY IMPLEMENTED
|
||||
m_scene.ExternalChecks.addCheckEditScript(CanEditScript); //NOT YET IMPLEMENTED
|
||||
m_scene.ExternalChecks.addCheckEditNotecard(CanEditNotecard); //NOT YET IMPLEMENTED
|
||||
m_scene.ExternalChecks.addCheckInstantMessage(CanInstantMessage); //FULLY IMPLEMENTED
|
||||
m_scene.ExternalChecks.addCheckInventoryTransfer(CanInventoryTransfer); //NOT YET IMPLEMENTED
|
||||
m_scene.ExternalChecks.addCheckIssueEstateCommand(CanIssueEstateCommand); //FULLY IMPLEMENTED
|
||||
|
@ -165,11 +166,14 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
|
|||
m_scene.ExternalChecks.addCheckTakeCopyObject(CanTakeCopyObject); //FULLY IMPLEMENTED
|
||||
m_scene.ExternalChecks.addCheckTerraformLand(CanTerraformLand); //FULL IMPLEMENTED (POINT ONLY!!! NOT AREA!!!)
|
||||
m_scene.ExternalChecks.addCheckViewScript(CanViewScript); //NOT YET IMPLEMENTED
|
||||
|
||||
//NEEDED PERMS:
|
||||
//CanLinkObject
|
||||
//CanDelinkObject
|
||||
//CanBuyLand
|
||||
m_scene.ExternalChecks.addCheckViewNotecard(CanViewNotecard); //NOT YET IMPLEMENTED
|
||||
m_scene.ExternalChecks.addCheckCanLinkObject(CanLinkObject); //NOT YET IMPLEMENTED
|
||||
m_scene.ExternalChecks.addCheckCanDelinkObject(CanDelinkObject); //NOT YET IMPLEMENTED
|
||||
m_scene.ExternalChecks.addCheckCanBuyLand(CanBuyLand); //NOT YET IMPLEMENTED
|
||||
m_scene.ExternalChecks.addCheckCanCopyInventory(CanCopyInventory); //NOT YET IMPLEMENTED
|
||||
m_scene.ExternalChecks.addCheckCanDeleteInventory(CanDeleteInventory); //NOT YET IMPLEMENTED
|
||||
m_scene.ExternalChecks.addCheckCanCreateInventory(CanCreateInventory); //NOT YET IMPLEMENTED
|
||||
m_scene.ExternalChecks.addCheckCanTeleport(CanTeleport); //NOT YET IMPLEMENTED
|
||||
|
||||
|
||||
//Register Debug Commands
|
||||
|
@ -568,7 +572,15 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
|
|||
return GenericParcelPermission(user, parcel);
|
||||
}
|
||||
|
||||
private bool CanEditScript(LLUUID script, LLUUID user, Scene scene)
|
||||
private bool CanEditScript(LLUUID script, LLUUID objectID, LLUUID user, Scene scene)
|
||||
{
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool CanEditNotecard(LLUUID notecard, LLUUID objectID, LLUUID user, Scene scene)
|
||||
{
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
@ -771,7 +783,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
|
|||
return IsAdministrator(user);
|
||||
}
|
||||
|
||||
private bool CanRunScript(LLUUID script, LLUUID user, Scene scene)
|
||||
private bool CanRunScript(LLUUID script, LLUUID objectID, LLUUID user, Scene scene)
|
||||
{
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
@ -859,15 +871,80 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
|
|||
return permission;
|
||||
}
|
||||
|
||||
private bool CanViewScript(LLUUID script, LLUUID user, Scene scene)
|
||||
private bool CanViewScript(LLUUID script, LLUUID objectID, LLUUID user, Scene scene)
|
||||
{
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool CanViewNotecard(LLUUID notecard, LLUUID objectID, LLUUID user, Scene scene)
|
||||
{
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public bool CanLinkObject(LLUUID userID, LLUUID objectID)
|
||||
{
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CanDelinkObject(LLUUID userID, LLUUID objectID)
|
||||
{
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CanBuyLand(LLUUID userID, ILandObject parcel, Scene scene)
|
||||
{
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CanCopyInventory(LLUUID itemID, LLUUID objectID, LLUUID userID)
|
||||
{
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CanDeleteInventory(LLUUID itemID, LLUUID objectID, LLUUID userID)
|
||||
{
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CanCreateInventory(uint invType, LLUUID objectID, LLUUID userID)
|
||||
{
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CanTeleport(LLUUID userID)
|
||||
{
|
||||
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
|
||||
if (m_bypassPermissions) return m_bypassPermissionsValue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -437,7 +437,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
#endregion
|
||||
|
||||
#region VIEW SCRIPT
|
||||
public delegate bool CanViewScript(LLUUID script, LLUUID user, Scene scene);
|
||||
public delegate bool CanViewScript(LLUUID script, LLUUID objectID, LLUUID user, Scene scene);
|
||||
private List<CanViewScript> CanViewScriptCheckFunctions = new List<CanViewScript>();
|
||||
|
||||
public void addCheckViewScript(CanViewScript delegateFunc)
|
||||
|
@ -451,11 +451,37 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
CanViewScriptCheckFunctions.Remove(delegateFunc);
|
||||
}
|
||||
|
||||
public bool ExternalChecksCanViewScript(LLUUID script, LLUUID user)
|
||||
public bool ExternalChecksCanViewScript(LLUUID script, LLUUID objectID, LLUUID user)
|
||||
{
|
||||
foreach (CanViewScript check in CanViewScriptCheckFunctions)
|
||||
{
|
||||
if (check(script, user, m_scene) == false)
|
||||
if (check(script, objectID, user, m_scene) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public delegate bool CanViewNotecard(LLUUID script, LLUUID objectID, LLUUID user, Scene scene);
|
||||
private List<CanViewNotecard> CanViewNotecardCheckFunctions = new List<CanViewNotecard>();
|
||||
|
||||
public void addCheckViewNotecard(CanViewNotecard delegateFunc)
|
||||
{
|
||||
if (!CanViewNotecardCheckFunctions.Contains(delegateFunc))
|
||||
CanViewNotecardCheckFunctions.Add(delegateFunc);
|
||||
}
|
||||
public void removeCheckViewNotecard(CanViewNotecard delegateFunc)
|
||||
{
|
||||
if (CanViewNotecardCheckFunctions.Contains(delegateFunc))
|
||||
CanViewNotecardCheckFunctions.Remove(delegateFunc);
|
||||
}
|
||||
|
||||
public bool ExternalChecksCanViewNotecard(LLUUID script, LLUUID objectID, LLUUID user)
|
||||
{
|
||||
foreach (CanViewNotecard check in CanViewNotecardCheckFunctions)
|
||||
{
|
||||
if (check(script, objectID, user, m_scene) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -466,7 +492,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
#endregion
|
||||
|
||||
#region EDIT SCRIPT
|
||||
public delegate bool CanEditScript(LLUUID script, LLUUID user, Scene scene);
|
||||
public delegate bool CanEditScript(LLUUID script, LLUUID objectID, LLUUID user, Scene scene);
|
||||
private List<CanEditScript> CanEditScriptCheckFunctions = new List<CanEditScript>();
|
||||
|
||||
public void addCheckEditScript(CanEditScript delegateFunc)
|
||||
|
@ -480,11 +506,37 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
CanEditScriptCheckFunctions.Remove(delegateFunc);
|
||||
}
|
||||
|
||||
public bool ExternalChecksCanEditScript(LLUUID script, LLUUID user)
|
||||
public bool ExternalChecksCanEditScript(LLUUID script, LLUUID objectID, LLUUID user)
|
||||
{
|
||||
foreach (CanEditScript check in CanEditScriptCheckFunctions)
|
||||
{
|
||||
if (check(script, user, m_scene) == false)
|
||||
if (check(script, objectID, user, m_scene) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public delegate bool CanEditNotecard(LLUUID notecard, LLUUID objectID, LLUUID user, Scene scene);
|
||||
private List<CanEditNotecard> CanEditNotecardCheckFunctions = new List<CanEditNotecard>();
|
||||
|
||||
public void addCheckEditNotecard(CanEditNotecard delegateFunc)
|
||||
{
|
||||
if (!CanEditNotecardCheckFunctions.Contains(delegateFunc))
|
||||
CanEditNotecardCheckFunctions.Add(delegateFunc);
|
||||
}
|
||||
public void removeCheckEditNotecard(CanEditNotecard delegateFunc)
|
||||
{
|
||||
if (CanEditNotecardCheckFunctions.Contains(delegateFunc))
|
||||
CanEditNotecardCheckFunctions.Remove(delegateFunc);
|
||||
}
|
||||
|
||||
public bool ExternalChecksCanEditNotecard(LLUUID script, LLUUID objectID, LLUUID user)
|
||||
{
|
||||
foreach (CanEditNotecard check in CanEditNotecardCheckFunctions)
|
||||
{
|
||||
if (check(script, objectID, user, m_scene) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -495,7 +547,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
#endregion
|
||||
|
||||
#region RUN SCRIPT
|
||||
public delegate bool CanRunScript(LLUUID script, LLUUID user, Scene scene);
|
||||
public delegate bool CanRunScript(LLUUID script, LLUUID objectID, LLUUID user, Scene scene);
|
||||
private List<CanRunScript> CanRunScriptCheckFunctions = new List<CanRunScript>();
|
||||
|
||||
public void addCheckRunScript(CanRunScript delegateFunc)
|
||||
|
@ -509,11 +561,11 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
CanRunScriptCheckFunctions.Remove(delegateFunc);
|
||||
}
|
||||
|
||||
public bool ExternalChecksCanRunScript(LLUUID script, LLUUID user)
|
||||
public bool ExternalChecksCanRunScript(LLUUID script, LLUUID objectID, LLUUID user)
|
||||
{
|
||||
foreach (CanRunScript check in CanRunScriptCheckFunctions)
|
||||
{
|
||||
if (check(script, user, m_scene) == false)
|
||||
if (check(script, objectID, user, m_scene) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -721,9 +773,189 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
#endregion
|
||||
|
||||
public delegate bool CanBuyLand(LLUUID user, ILandObject parcel, Scene scene);
|
||||
private List<CanBuyLand> CanBuyLandCheckFunctions = new List<CanBuyLand>();
|
||||
|
||||
public void addCheckCanBuyLand(CanBuyLand delegateFunc)
|
||||
{
|
||||
if (!CanBuyLandCheckFunctions.Contains(delegateFunc))
|
||||
CanBuyLandCheckFunctions.Add(delegateFunc);
|
||||
}
|
||||
public void removeCheckCanBuyLand(CanBuyLand delegateFunc)
|
||||
{
|
||||
if (CanBuyLandCheckFunctions.Contains(delegateFunc))
|
||||
CanBuyLandCheckFunctions.Remove(delegateFunc);
|
||||
}
|
||||
|
||||
public bool ExternalChecksCanBuyLand(LLUUID user, ILandObject parcel)
|
||||
{
|
||||
foreach (CanBuyLand check in CanBuyLandCheckFunctions)
|
||||
{
|
||||
if (check(user, parcel, m_scene) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public delegate bool CanLinkObject(LLUUID user, LLUUID objectID);
|
||||
private List<CanLinkObject> CanLinkObjectCheckFunctions = new List<CanLinkObject>();
|
||||
|
||||
public void addCheckCanLinkObject(CanLinkObject delegateFunc)
|
||||
{
|
||||
if (!CanLinkObjectCheckFunctions.Contains(delegateFunc))
|
||||
CanLinkObjectCheckFunctions.Add(delegateFunc);
|
||||
}
|
||||
public void removeCheckCanLinkObject(CanLinkObject delegateFunc)
|
||||
{
|
||||
if (CanLinkObjectCheckFunctions.Contains(delegateFunc))
|
||||
CanLinkObjectCheckFunctions.Remove(delegateFunc);
|
||||
}
|
||||
|
||||
public bool ExternalChecksCanLinkObject(LLUUID user, LLUUID objectID)
|
||||
{
|
||||
foreach (CanLinkObject check in CanLinkObjectCheckFunctions)
|
||||
{
|
||||
if (check(user, objectID) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public delegate bool CanDelinkObject(LLUUID user, LLUUID objectID);
|
||||
private List<CanDelinkObject> CanDelinkObjectCheckFunctions = new List<CanDelinkObject>();
|
||||
|
||||
public void addCheckCanDelinkObject(CanDelinkObject delegateFunc)
|
||||
{
|
||||
if (!CanDelinkObjectCheckFunctions.Contains(delegateFunc))
|
||||
CanDelinkObjectCheckFunctions.Add(delegateFunc);
|
||||
}
|
||||
public void removeCheckCanDelinkObject(CanDelinkObject delegateFunc)
|
||||
{
|
||||
if (CanDelinkObjectCheckFunctions.Contains(delegateFunc))
|
||||
CanDelinkObjectCheckFunctions.Remove(delegateFunc);
|
||||
}
|
||||
|
||||
public bool ExternalChecksCanDelinkObject(LLUUID user, LLUUID objectID)
|
||||
{
|
||||
foreach (CanDelinkObject check in CanDelinkObjectCheckFunctions)
|
||||
{
|
||||
if (check(user, objectID) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public delegate bool CanCreateInventory(uint invType, LLUUID objectID, LLUUID userID);
|
||||
private List<CanCreateInventory> CanCreateInventoryCheckFunctions = new List<CanCreateInventory>();
|
||||
|
||||
public void addCheckCanCreateInventory(CanCreateInventory delegateFunc)
|
||||
{
|
||||
if (!CanCreateInventoryCheckFunctions.Contains(delegateFunc))
|
||||
CanCreateInventoryCheckFunctions.Add(delegateFunc);
|
||||
}
|
||||
public void removeCheckCanCreateInventory(CanCreateInventory delegateFunc)
|
||||
{
|
||||
if (CanCreateInventoryCheckFunctions.Contains(delegateFunc))
|
||||
CanCreateInventoryCheckFunctions.Remove(delegateFunc);
|
||||
}
|
||||
|
||||
public bool ExternalChecksCanCreateInventory(uint invType, LLUUID objectID, LLUUID userID)
|
||||
{
|
||||
foreach (CanCreateInventory check in CanCreateInventoryCheckFunctions)
|
||||
{
|
||||
if (check(invType, objectID, userID) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public delegate bool CanCopyInventory(LLUUID itemID, LLUUID objectID, LLUUID userID);
|
||||
private List<CanCopyInventory> CanCopyInventoryCheckFunctions = new List<CanCopyInventory>();
|
||||
|
||||
public void addCheckCanCopyInventory(CanCopyInventory delegateFunc)
|
||||
{
|
||||
if (!CanCopyInventoryCheckFunctions.Contains(delegateFunc))
|
||||
CanCopyInventoryCheckFunctions.Add(delegateFunc);
|
||||
}
|
||||
public void removeCheckCanCopyInventory(CanCopyInventory delegateFunc)
|
||||
{
|
||||
if (CanCopyInventoryCheckFunctions.Contains(delegateFunc))
|
||||
CanCopyInventoryCheckFunctions.Remove(delegateFunc);
|
||||
}
|
||||
|
||||
public bool ExternalChecksCanCopyInventory(LLUUID itemID, LLUUID objectID, LLUUID userID)
|
||||
{
|
||||
foreach (CanCopyInventory check in CanCopyInventoryCheckFunctions)
|
||||
{
|
||||
if (check(itemID, objectID, userID) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public delegate bool CanDeleteInventory(LLUUID itemID, LLUUID objectID, LLUUID userID);
|
||||
private List<CanDeleteInventory> CanDeleteInventoryCheckFunctions = new List<CanDeleteInventory>();
|
||||
|
||||
public void addCheckCanDeleteInventory(CanDeleteInventory delegateFunc)
|
||||
{
|
||||
if (!CanDeleteInventoryCheckFunctions.Contains(delegateFunc))
|
||||
CanDeleteInventoryCheckFunctions.Add(delegateFunc);
|
||||
}
|
||||
public void removeCheckCanDeleteInventory(CanDeleteInventory delegateFunc)
|
||||
{
|
||||
if (CanDeleteInventoryCheckFunctions.Contains(delegateFunc))
|
||||
CanDeleteInventoryCheckFunctions.Remove(delegateFunc);
|
||||
}
|
||||
|
||||
public bool ExternalChecksCanDeleteInventory(LLUUID itemID, LLUUID objectID, LLUUID userID)
|
||||
{
|
||||
foreach (CanDeleteInventory check in CanDeleteInventoryCheckFunctions)
|
||||
{
|
||||
if (check(itemID, objectID, userID) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public delegate bool CanTeleport(LLUUID userID);
|
||||
private List<CanTeleport> CanTeleportCheckFunctions = new List<CanTeleport>();
|
||||
|
||||
public void addCheckCanTeleport(CanTeleport delegateFunc)
|
||||
{
|
||||
if (!CanTeleportCheckFunctions.Contains(delegateFunc))
|
||||
CanTeleportCheckFunctions.Add(delegateFunc);
|
||||
}
|
||||
public void removeCheckCanTeleport(CanTeleport delegateFunc)
|
||||
{
|
||||
if (CanTeleportCheckFunctions.Contains(delegateFunc))
|
||||
CanTeleportCheckFunctions.Remove(delegateFunc);
|
||||
}
|
||||
|
||||
public bool ExternalChecksCanTeleport(LLUUID userID)
|
||||
{
|
||||
foreach (CanTeleport check in CanTeleportCheckFunctions)
|
||||
{
|
||||
if (check(userID) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue