diff options
author | Melanie | 2012-09-24 20:14:00 +0100 |
---|---|---|
committer | Melanie | 2012-09-24 20:14:00 +0100 |
commit | bbaf2c5a80441fdbd2f55e02ec9f46c3b66869c6 (patch) | |
tree | 2ac67907f6333bbbc9e4d821c6607b53d0e22acb /OpenSim/Services/HypergridService/HGAssetService.cs | |
parent | Merge branch 'master' into careminster (diff) | |
parent | HG Rez object: warn the user if the item or asset cannot be found. (diff) | |
download | opensim-SC-bbaf2c5a80441fdbd2f55e02ec9f46c3b66869c6.zip opensim-SC-bbaf2c5a80441fdbd2f55e02ec9f46c3b66869c6.tar.gz opensim-SC-bbaf2c5a80441fdbd2f55e02ec9f46c3b66869c6.tar.bz2 opensim-SC-bbaf2c5a80441fdbd2f55e02ec9f46c3b66869c6.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to 'OpenSim/Services/HypergridService/HGAssetService.cs')
-rw-r--r-- | OpenSim/Services/HypergridService/HGAssetService.cs | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/OpenSim/Services/HypergridService/HGAssetService.cs b/OpenSim/Services/HypergridService/HGAssetService.cs index db98166..84dec8d 100644 --- a/OpenSim/Services/HypergridService/HGAssetService.cs +++ b/OpenSim/Services/HypergridService/HGAssetService.cs | |||
@@ -58,6 +58,8 @@ namespace OpenSim.Services.HypergridService | |||
58 | 58 | ||
59 | private UserAccountCache m_Cache; | 59 | private UserAccountCache m_Cache; |
60 | 60 | ||
61 | private AssetPermissions m_AssetPerms; | ||
62 | |||
61 | public HGAssetService(IConfigSource config, string configName) : base(config, configName) | 63 | public HGAssetService(IConfigSource config, string configName) : base(config, configName) |
62 | { | 64 | { |
63 | m_log.Debug("[HGAsset Service]: Starting"); | 65 | m_log.Debug("[HGAsset Service]: Starting"); |
@@ -80,6 +82,10 @@ namespace OpenSim.Services.HypergridService | |||
80 | m_HomeURL = assetConfig.GetString("HomeURI", m_HomeURL); | 82 | m_HomeURL = assetConfig.GetString("HomeURI", m_HomeURL); |
81 | 83 | ||
82 | m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); | 84 | m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); |
85 | |||
86 | // Permissions | ||
87 | m_AssetPerms = new AssetPermissions(assetConfig); | ||
88 | |||
83 | } | 89 | } |
84 | 90 | ||
85 | #region IAssetService overrides | 91 | #region IAssetService overrides |
@@ -90,6 +96,9 @@ namespace OpenSim.Services.HypergridService | |||
90 | if (asset == null) | 96 | if (asset == null) |
91 | return null; | 97 | return null; |
92 | 98 | ||
99 | if (!m_AssetPerms.AllowedExport(asset.Type)) | ||
100 | return null; | ||
101 | |||
93 | if (asset.Metadata.Type == (sbyte)AssetType.Object) | 102 | if (asset.Metadata.Type == (sbyte)AssetType.Object) |
94 | asset.Data = AdjustIdentifiers(asset.Data); ; | 103 | asset.Data = AdjustIdentifiers(asset.Data); ; |
95 | 104 | ||
@@ -112,16 +121,27 @@ namespace OpenSim.Services.HypergridService | |||
112 | 121 | ||
113 | public override byte[] GetData(string id) | 122 | public override byte[] GetData(string id) |
114 | { | 123 | { |
115 | byte[] data = base.GetData(id); | 124 | AssetBase asset = Get(id); |
125 | |||
126 | if (asset == null) | ||
127 | return null; | ||
116 | 128 | ||
117 | if (data == null) | 129 | if (!m_AssetPerms.AllowedExport(asset.Type)) |
118 | return null; | 130 | return null; |
119 | 131 | ||
120 | return AdjustIdentifiers(data); | 132 | return asset.Data; |
121 | } | 133 | } |
122 | 134 | ||
123 | //public virtual bool Get(string id, Object sender, AssetRetrieved handler) | 135 | //public virtual bool Get(string id, Object sender, AssetRetrieved handler) |
124 | 136 | ||
137 | public override string Store(AssetBase asset) | ||
138 | { | ||
139 | if (!m_AssetPerms.AllowedImport(asset.Type)) | ||
140 | return string.Empty; | ||
141 | |||
142 | return base.Store(asset); | ||
143 | } | ||
144 | |||
125 | public override bool Delete(string id) | 145 | public override bool Delete(string id) |
126 | { | 146 | { |
127 | // NOGO | 147 | // NOGO |