HG 2.0: added asset import/export policies at the sim too.

connector_plugin
Diva Canto 2012-09-21 07:44:18 -07:00
parent 5f97b3e1d9
commit b542622b3a
4 changed files with 37 additions and 10 deletions

View File

@ -56,6 +56,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
private bool m_Enabled = false;
private AssetPermissions m_AssetPerms;
public Type ReplaceableInterface
{
get { return null; }
@ -128,6 +130,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (m_LocalAssetServiceURI != string.Empty)
m_LocalAssetServiceURI = m_LocalAssetServiceURI.Trim('/');
IConfig hgConfig = source.Configs["HGAssetService"];
m_AssetPerms = new AssetPermissions(hgConfig);
m_Enabled = true;
m_log.Info("[HG ASSET CONNECTOR]: HG asset broker enabled");
}
@ -206,14 +211,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
asset = m_HGService.Get(id);
if (asset != null)
{
// Now store it locally
// For now, let me just do it for textures and scripts
if (((AssetType)asset.Type == AssetType.Texture) ||
((AssetType)asset.Type == AssetType.LSLBytecode) ||
((AssetType)asset.Type == AssetType.LSLText))
{
// Now store it locally, if allowed
if (m_AssetPerms.AllowedImport(asset.Type))
m_GridService.Store(asset);
}
else
return null;
}
}
else
@ -328,7 +330,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
string id = string.Empty;
if (IsHG(asset.ID))
id = m_HGService.Store(asset);
{
if (m_AssetPerms.AllowedExport(asset.Type))
id = m_HGService.Store(asset);
else
return String.Empty;
}
else
id = m_GridService.Store(asset);

View File

@ -437,7 +437,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
UserAccountsService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
HomeURI = "http://127.0.0.1:8002"
;; The asset types that this service can export to / import from other grids.
;; The asset types that this grid can export to / import from other grids.
;; Comma separated.
;; Valid values are all the asset types in OpenMetaverse.AssetType, namely:
;; Unknown, Texture, Sound, CallingCard, Landmark, Clothing, Object, Notecard, LSLText,

View File

@ -137,6 +137,26 @@
;; uncomment the next line. You may want to do this on sims that have licensed content.
; OutboundPermission = False
[HGAssetService]
;
; === HG ONLY ===
; Change this to your server
; accessible from other grids
;
HomeURI = "http://mygridserver.com:8002"
;; The asset types that this grid can export to / import from other grids.
;; Comma separated.
;; Valid values are all the asset types in OpenMetaverse.AssetType, namely:
;; Unknown, Texture, Sound, CallingCard, Landmark, Clothing, Object, Notecard, LSLText,
;; LSLBytecode, TextureTGA, Bodypart, SoundWAV, ImageTGA, ImageJPEG, Animation, Gesture, Mesh
;;
;; Leave blank or commented if you don't want to apply any restrictions.
;; A more strict, but still reasonable, policy may be to disallow the exchange
;; of scripts, like so:
; DisallowExport ="LSLText"
; DisallowImport ="LSLBytecode"
[HGFriendsModule]
; User level required to be able to send friendship invitations to foreign users
;LevelHGFriends = 0;

View File

@ -53,7 +53,7 @@
[HGAssetService]
HomeURI = "http://127.0.0.1:9000"
;; The asset types that this service can export to / import from other grids.
;; The asset types that this grid can export to / import from other grids.
;; Comma separated.
;; Valid values are all the asset types in OpenMetaverse.AssetType, namely:
;; Unknown, Texture, Sound, CallingCard, Landmark, Clothing, Object, Notecard, LSLText,