diff options
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | 94 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 |
2 files changed, 69 insertions, 27 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 12e53a8..081281e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -252,18 +252,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
252 | } | 252 | } |
253 | 253 | ||
254 | // new test code, to place in better place later | 254 | // new test code, to place in better place later |
255 | private object PermissionsLock = new object(); | 255 | private object m_PermissionsLock = new object(); |
256 | private bool m_EffectivePermsInvalid = true; | ||
257 | |||
258 | public void InvalidateEffectivePerms() | ||
259 | { | ||
260 | lock(m_PermissionsLock) | ||
261 | m_EffectivePermsInvalid = true; | ||
262 | } | ||
256 | 263 | ||
257 | private uint m_EffectiveEveryOnePerms; | 264 | private uint m_EffectiveEveryOnePerms; |
258 | public uint EffectiveEveryOnePerms | 265 | public uint EffectiveEveryOnePerms |
259 | { | 266 | { |
260 | get | 267 | get |
261 | { | 268 | { |
262 | // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) | 269 | lock(m_PermissionsLock) |
263 | // bc this is on heavy duty code paths | 270 | { |
264 | // but for now we need to test the concept | 271 | if(m_EffectivePermsInvalid) |
265 | // AggregateDeepPerms(); | 272 | AggregatePerms(); |
266 | return m_EffectiveEveryOnePerms; | 273 | return m_EffectiveEveryOnePerms; |
274 | } | ||
267 | } | 275 | } |
268 | } | 276 | } |
269 | 277 | ||
@@ -272,11 +280,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
272 | { | 280 | { |
273 | get | 281 | get |
274 | { | 282 | { |
275 | // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) | 283 | lock(m_PermissionsLock) |
276 | // bc this is on heavy duty code paths | 284 | { |
277 | // but for now we need to test the concept | 285 | if(m_EffectivePermsInvalid) |
278 | // AggregateDeepPerms(); | 286 | AggregatePerms(); |
279 | return m_EffectiveGroupPerms; | 287 | return m_EffectiveGroupPerms; |
288 | } | ||
280 | } | 289 | } |
281 | } | 290 | } |
282 | 291 | ||
@@ -285,11 +294,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
285 | { | 294 | { |
286 | get | 295 | get |
287 | { | 296 | { |
288 | // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) | 297 | lock(m_PermissionsLock) |
289 | // bc this is on heavy duty code paths | 298 | { |
290 | // but for now we need to test the concept | 299 | if(m_EffectivePermsInvalid) |
291 | // AggregateDeepPerms(); | 300 | AggregatePerms(); |
292 | return m_EffectiveGroupOrEveryOnePerms; | 301 | return m_EffectiveGroupOrEveryOnePerms; |
302 | } | ||
293 | } | 303 | } |
294 | } | 304 | } |
295 | 305 | ||
@@ -298,11 +308,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
298 | { | 308 | { |
299 | get | 309 | get |
300 | { | 310 | { |
301 | // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) | 311 | lock(m_PermissionsLock) |
302 | // bc this is on heavy duty code paths | 312 | { |
303 | // but for now we need to test the concept | 313 | if(m_EffectivePermsInvalid) |
304 | // AggregateDeepPerms(); | 314 | AggregatePerms(); |
305 | return m_EffectiveOwnerPerms; | 315 | return m_EffectiveOwnerPerms; |
316 | } | ||
306 | } | 317 | } |
307 | } | 318 | } |
308 | 319 | ||
@@ -310,7 +321,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
310 | // AggregatePerms does same using cached parts content perms | 321 | // AggregatePerms does same using cached parts content perms |
311 | public void AggregateDeepPerms() | 322 | public void AggregateDeepPerms() |
312 | { | 323 | { |
313 | lock(PermissionsLock) | 324 | lock(m_PermissionsLock) |
314 | { | 325 | { |
315 | // aux | 326 | // aux |
316 | const uint allmask = (uint)PermissionMask.AllEffective; | 327 | const uint allmask = (uint)PermissionMask.AllEffective; |
@@ -370,6 +381,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
370 | 381 | ||
371 | m_EffectiveEveryOnePerms = everyone & owner; | 382 | m_EffectiveEveryOnePerms = everyone & owner; |
372 | m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner; | 383 | m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner; |
384 | m_EffectivePermsInvalid = false; | ||
373 | } | 385 | } |
374 | } | 386 | } |
375 | 387 | ||
@@ -377,7 +389,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
377 | // ie is AggregateDeepPerms without the part.AggregateInnerPerms() call on parts loop | 389 | // ie is AggregateDeepPerms without the part.AggregateInnerPerms() call on parts loop |
378 | public void AggregatePerms() | 390 | public void AggregatePerms() |
379 | { | 391 | { |
380 | lock(PermissionsLock) | 392 | lock(m_PermissionsLock) |
381 | { | 393 | { |
382 | // aux | 394 | // aux |
383 | const uint allmask = (uint)PermissionMask.AllEffective; | 395 | const uint allmask = (uint)PermissionMask.AllEffective; |
@@ -394,6 +406,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
394 | uint rootEveryonePerms = RootPart.EveryoneMask; | 406 | uint rootEveryonePerms = RootPart.EveryoneMask; |
395 | uint everyone = rootEveryonePerms; | 407 | uint everyone = rootEveryonePerms; |
396 | 408 | ||
409 | bool needUpdate = false; | ||
410 | |||
397 | SceneObjectPart[] parts = m_parts.GetArray(); | 411 | SceneObjectPart[] parts = m_parts.GetArray(); |
398 | for (int i = 0; i < parts.Length; i++) | 412 | for (int i = 0; i < parts.Length; i++) |
399 | { | 413 | { |
@@ -409,7 +423,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
409 | owner |= (uint)PermissionMask.Transfer; | 423 | owner |= (uint)PermissionMask.Transfer; |
410 | 424 | ||
411 | owner &= basePerms; | 425 | owner &= basePerms; |
412 | m_EffectiveOwnerPerms = owner; | 426 | if(owner != m_EffectiveOwnerPerms) |
427 | { | ||
428 | needUpdate = true; | ||
429 | m_EffectiveOwnerPerms = owner; | ||
430 | } | ||
431 | |||
413 | uint ownertransfermask = owner & (uint)PermissionMask.Transfer; | 432 | uint ownertransfermask = owner & (uint)PermissionMask.Transfer; |
414 | 433 | ||
415 | // recover modify and move | 434 | // recover modify and move |
@@ -421,7 +440,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
421 | group |= ownertransfermask; | 440 | group |= ownertransfermask; |
422 | 441 | ||
423 | uint groupOrEveryone = group; | 442 | uint groupOrEveryone = group; |
424 | m_EffectiveGroupPerms = group & owner; | 443 | uint tmpPerms = group & owner; |
444 | if(tmpPerms != m_EffectiveGroupPerms) | ||
445 | { | ||
446 | needUpdate = true; | ||
447 | m_EffectiveGroupPerms = tmpPerms; | ||
448 | } | ||
425 | 449 | ||
426 | // recover move | 450 | // recover move |
427 | rootEveryonePerms &= (uint)PermissionMask.Move; | 451 | rootEveryonePerms &= (uint)PermissionMask.Move; |
@@ -434,8 +458,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
434 | 458 | ||
435 | groupOrEveryone |= everyone; | 459 | groupOrEveryone |= everyone; |
436 | 460 | ||
437 | m_EffectiveEveryOnePerms = everyone & owner; | 461 | tmpPerms = everyone & owner; |
438 | m_EffectiveGroupOrEveryOnePerms = groupOrEveryone & owner; | 462 | if(tmpPerms != m_EffectiveEveryOnePerms) |
463 | { | ||
464 | needUpdate = true; | ||
465 | m_EffectiveEveryOnePerms = tmpPerms; | ||
466 | } | ||
467 | |||
468 | tmpPerms = groupOrEveryone & owner; | ||
469 | if(tmpPerms != m_EffectiveGroupOrEveryOnePerms) | ||
470 | { | ||
471 | needUpdate = true; | ||
472 | m_EffectiveGroupOrEveryOnePerms = tmpPerms; | ||
473 | } | ||
474 | |||
475 | m_EffectivePermsInvalid = false; | ||
476 | |||
477 | if(needUpdate) | ||
478 | RootPart.ScheduleFullUpdate(); | ||
439 | } | 479 | } |
440 | } | 480 | } |
441 | 481 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 19bf53f..e4f18d9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2579,6 +2579,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2579 | AggregatedInnerOwnerPerms = owner & mask; | 2579 | AggregatedInnerOwnerPerms = owner & mask; |
2580 | AggregatedInnerGroupPerms = group & mask; | 2580 | AggregatedInnerGroupPerms = group & mask; |
2581 | AggregatedInnerEveryonePerms = everyone & mask; | 2581 | AggregatedInnerEveryonePerms = everyone & mask; |
2582 | if(ParentGroup != null) | ||
2583 | ParentGroup.InvalidateEffectivePerms(); | ||
2582 | } | 2584 | } |
2583 | } | 2585 | } |
2584 | 2586 | ||