diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | 177 |
1 files changed, 177 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 9f98554..f44604b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -248,6 +248,183 @@ namespace OpenSim.Region.Framework.Scenes | |||
248 | return -1; | 248 | return -1; |
249 | } | 249 | } |
250 | 250 | ||
251 | // new test code, to place in better place later | ||
252 | private object PermissionsLock = new object(); | ||
253 | |||
254 | private uint m_EffectiveEveryOnePerms; | ||
255 | public uint EffectiveEveryOnePerms | ||
256 | { | ||
257 | get | ||
258 | { | ||
259 | // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) | ||
260 | // bc this is on heavy duty code paths | ||
261 | // but for now we need to test the concept | ||
262 | AggregateEveryOnePerms(); | ||
263 | return m_EffectiveEveryOnePerms; | ||
264 | } | ||
265 | } | ||
266 | |||
267 | public void AggregateEveryOnePerms() | ||
268 | { | ||
269 | lock(PermissionsLock) | ||
270 | { | ||
271 | // get object everyone permissions | ||
272 | uint baseperms = RootPart.EveryoneMask & (uint)PermissionMask.All; | ||
273 | |||
274 | if(baseperms == 0) | ||
275 | { | ||
276 | m_EffectiveEveryOnePerms = 0; | ||
277 | return; | ||
278 | } | ||
279 | |||
280 | uint current = baseperms; | ||
281 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
282 | for (int i = 0; i < parts.Length; i++) | ||
283 | { | ||
284 | SceneObjectPart part = parts[i]; | ||
285 | part.Inventory.AggregateEveryOnePerms(ref current); | ||
286 | if( current == 0) | ||
287 | break; | ||
288 | } | ||
289 | // recover move | ||
290 | baseperms &= (uint)PermissionMask.Move; | ||
291 | current |= baseperms; | ||
292 | current &= (uint)PermissionMask.All; | ||
293 | m_EffectiveEveryOnePerms = current; | ||
294 | } | ||
295 | } | ||
296 | |||
297 | private uint m_EffectiveGroupPerms; | ||
298 | public uint EffectiveGroupPerms | ||
299 | { | ||
300 | get | ||
301 | { | ||
302 | // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) | ||
303 | // bc this is on heavy duty code paths | ||
304 | // but for now we need to test the concept | ||
305 | AggregateGroupPerms(); | ||
306 | return m_EffectiveGroupPerms; | ||
307 | } | ||
308 | } | ||
309 | |||
310 | public void AggregateGroupPerms() | ||
311 | { | ||
312 | lock(PermissionsLock) | ||
313 | { | ||
314 | // get object everyone permissions | ||
315 | uint baseperms = RootPart.GroupMask & (uint)PermissionMask.All; | ||
316 | |||
317 | if(baseperms == 0) | ||
318 | { | ||
319 | m_EffectiveGroupPerms = 0; | ||
320 | return; | ||
321 | } | ||
322 | |||
323 | uint current = baseperms; | ||
324 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
325 | for (int i = 0; i < parts.Length; i++) | ||
326 | { | ||
327 | SceneObjectPart part = parts[i]; | ||
328 | part.Inventory.AggregateGroupPerms(ref current); | ||
329 | if( current == 0) | ||
330 | break; | ||
331 | } | ||
332 | // recover modify and move | ||
333 | baseperms &= (uint)(PermissionMask.Move | PermissionMask.Modify ); | ||
334 | current |= baseperms; | ||
335 | current &= (uint)PermissionMask.All; | ||
336 | m_EffectiveGroupPerms = current; | ||
337 | } | ||
338 | } | ||
339 | |||
340 | private uint m_EffectiveGroupOrEveryOnePerms; | ||
341 | public uint EffectiveGroupOrEveryOnePerms | ||
342 | { | ||
343 | get | ||
344 | { | ||
345 | // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) | ||
346 | // bc this is on heavy duty code paths | ||
347 | // but for now we need to test the concept | ||
348 | AggregateGroupOrEveryOnePerms(); | ||
349 | return m_EffectiveGroupOrEveryOnePerms; | ||
350 | } | ||
351 | } | ||
352 | |||
353 | public void AggregateGroupOrEveryOnePerms() | ||
354 | { | ||
355 | lock(PermissionsLock) | ||
356 | { | ||
357 | // get object everyone permissions | ||
358 | uint baseperms = (RootPart.EveryoneMask | RootPart.GroupMask) & (uint)PermissionMask.All; | ||
359 | |||
360 | if(baseperms == 0) | ||
361 | { | ||
362 | m_EffectiveGroupOrEveryOnePerms = 0; | ||
363 | return; | ||
364 | } | ||
365 | |||
366 | uint current = baseperms; | ||
367 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
368 | for (int i = 0; i < parts.Length; i++) | ||
369 | { | ||
370 | SceneObjectPart part = parts[i]; | ||
371 | part.Inventory.AggregateGroupOrEveryonePerms(ref current); | ||
372 | if( current == 0) | ||
373 | break; | ||
374 | } | ||
375 | // recover modify and move | ||
376 | baseperms &= (uint)(PermissionMask.Move | PermissionMask.Modify ); | ||
377 | current |= baseperms; | ||
378 | current &= (uint)PermissionMask.All; | ||
379 | m_EffectiveGroupOrEveryOnePerms = current; | ||
380 | } | ||
381 | } | ||
382 | |||
383 | private uint m_EffectiveOwnerPerms; | ||
384 | public uint EffectiveOwnerPerms | ||
385 | { | ||
386 | get | ||
387 | { | ||
388 | // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) | ||
389 | // bc this is on heavy duty code paths | ||
390 | // but for now we need to test the concept | ||
391 | AggregateOwnerPerms(); | ||
392 | return m_EffectiveOwnerPerms; | ||
393 | } | ||
394 | } | ||
395 | |||
396 | public void AggregateOwnerPerms() | ||
397 | { | ||
398 | lock(PermissionsLock) | ||
399 | { | ||
400 | // get object everyone permissions | ||
401 | uint baseperms = RootPart.OwnerMask & (uint)PermissionMask.All; | ||
402 | |||
403 | if(baseperms == 0) | ||
404 | { | ||
405 | m_EffectiveOwnerPerms = 0; | ||
406 | return; | ||
407 | } | ||
408 | |||
409 | uint current = baseperms; | ||
410 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
411 | for (int i = 0; i < parts.Length; i++) | ||
412 | { | ||
413 | SceneObjectPart part = parts[i]; | ||
414 | part.Inventory.AggregateOwnerPerms(ref current); | ||
415 | if( current == 0) | ||
416 | break; | ||
417 | } | ||
418 | // recover modify and move | ||
419 | baseperms &= (uint)(PermissionMask.Move | PermissionMask.Modify ); | ||
420 | current |= baseperms; | ||
421 | current &= (uint)PermissionMask.All; | ||
422 | if((current & (uint)(PermissionMask.Copy | PermissionMask.Transfer)) == 0) | ||
423 | current |= (uint)PermissionMask.Transfer; | ||
424 | m_EffectiveOwnerPerms = current; | ||
425 | } | ||
426 | } | ||
427 | |||
251 | public uint GetEffectivePermissions() | 428 | public uint GetEffectivePermissions() |
252 | { | 429 | { |
253 | return GetEffectivePermissions(false); | 430 | return GetEffectivePermissions(false); |