Skip to content

Commit

Permalink
HG 2.0: added asset import/export policies at the sim too.
Browse files Browse the repository at this point in the history
  • Loading branch information
diva committed Sep 21, 2012
1 parent 5f97b3e commit b542622
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public class HGAssetBroker :

private bool m_Enabled = false;

private AssetPermissions m_AssetPerms;

public Type ReplaceableInterface
{
get { return null; }
Expand Down Expand Up @@ -128,6 +130,9 @@ public void Initialise(IConfigSource source)
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");
}
Expand Down Expand Up @@ -206,14 +211,11 @@ public AssetBase Get(string id)
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
Expand Down Expand Up @@ -328,7 +330,12 @@ public string Store(AssetBase 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);

Expand Down
2 changes: 1 addition & 1 deletion bin/Robust.HG.ini.example
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
20 changes: 20 additions & 0 deletions bin/config-include/GridCommon.ini.example
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion bin/config-include/StandaloneCommon.ini.example
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b542622

Please sign in to comment.