aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
diff options
context:
space:
mode:
authorUbitUmarov2017-01-16 19:01:41 +0000
committerUbitUmarov2017-01-16 19:01:41 +0000
commit733072b6a371f52d5c13f61d4b2a145a370370f5 (patch)
tree4944059a40baec7bbb70c341a57ea1f82345b830 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
parentMerge branch 'melanie' (diff)
downloadopensim-SC-733072b6a371f52d5c13f61d4b2a145a370370f5.zip
opensim-SC-733072b6a371f52d5c13f61d4b2a145a370370f5.tar.gz
opensim-SC-733072b6a371f52d5c13f61d4b2a145a370370f5.tar.bz2
opensim-SC-733072b6a371f52d5c13f61d4b2a145a370370f5.tar.xz
chance new effective permissions code to ease aggregation on demand( ie on changes). But still doing full aggregation on checks, so still heavy
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs198
1 files changed, 89 insertions, 109 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index f44604b..7b9ea8b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -259,41 +259,11 @@ namespace OpenSim.Region.Framework.Scenes
259 // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) 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 260 // bc this is on heavy duty code paths
261 // but for now we need to test the concept 261 // but for now we need to test the concept
262 AggregateEveryOnePerms(); 262 AggregateDeepPerms();
263 return m_EffectiveEveryOnePerms; 263 return m_EffectiveEveryOnePerms;
264 } 264 }
265 } 265 }
266 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; 267 private uint m_EffectiveGroupPerms;
298 public uint EffectiveGroupPerms 268 public uint EffectiveGroupPerms
299 { 269 {
@@ -302,126 +272,136 @@ namespace OpenSim.Region.Framework.Scenes
302 // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) 272 // 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 273 // bc this is on heavy duty code paths
304 // but for now we need to test the concept 274 // but for now we need to test the concept
305 AggregateGroupPerms(); 275 AggregateDeepPerms();
306 return m_EffectiveGroupPerms; 276 return m_EffectiveGroupPerms;
307 } 277 }
308 } 278 }
309 279
310 public void AggregateGroupPerms() 280 public uint EffectiveGroupOrEveryOnePerms
311 { 281 {
312 lock(PermissionsLock) 282 get
313 { 283 {
314 // get object everyone permissions 284 // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc)
315 uint baseperms = RootPart.GroupMask & (uint)PermissionMask.All; 285 // bc this is on heavy duty code paths
316 286 // but for now we need to test the concept
317 if(baseperms == 0) 287 AggregateDeepPerms();
318 { 288 return m_EffectiveEveryOnePerms | m_EffectiveGroupPerms;
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 } 289 }
338 } 290 }
339 291
340 private uint m_EffectiveGroupOrEveryOnePerms; 292 private uint m_EffectiveOwnerPerms;
341 public uint EffectiveGroupOrEveryOnePerms 293 public uint EffectiveOwnerPerms
342 { 294 {
343 get 295 get
344 { 296 {
345 // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) 297 // 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 298 // bc this is on heavy duty code paths
347 // but for now we need to test the concept 299 // but for now we need to test the concept
348 AggregateGroupOrEveryOnePerms(); 300 AggregateDeepPerms();
349 return m_EffectiveGroupOrEveryOnePerms; 301 return m_EffectiveOwnerPerms;
350 } 302 }
351 } 303 }
352 304
353 public void AggregateGroupOrEveryOnePerms() 305 // aggregates perms scanning parts and their contents
306 public void AggregateDeepPerms()
354 { 307 {
355 lock(PermissionsLock) 308 lock(PermissionsLock)
356 { 309 {
357 // get object everyone permissions 310 // aux
358 uint baseperms = (RootPart.EveryoneMask | RootPart.GroupMask) & (uint)PermissionMask.All; 311 const uint allmask = (uint)PermissionMask.AllEffective;
312 const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify);
313 const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer);
314
315 uint baseOwnerPerms = RootPart.OwnerMask;
316 uint owner = baseOwnerPerms;
317 uint baseGroupPerms = RootPart.GroupMask;
318 uint group = baseGroupPerms;
319 uint baseEveryonePerms = RootPart.EveryoneMask;
320 uint everyone = baseEveryonePerms;
359 321
360 if(baseperms == 0)
361 {
362 m_EffectiveGroupOrEveryOnePerms = 0;
363 return;
364 }
365
366 uint current = baseperms;
367 SceneObjectPart[] parts = m_parts.GetArray(); 322 SceneObjectPart[] parts = m_parts.GetArray();
368 for (int i = 0; i < parts.Length; i++) 323 for (int i = 0; i < parts.Length; i++)
369 { 324 {
370 SceneObjectPart part = parts[i]; 325 SceneObjectPart part = parts[i];
371 part.Inventory.AggregateGroupOrEveryonePerms(ref current); 326 part.AggregateInnerPerms();
372 if( current == 0) 327 owner &= part.AggregatedInnerOwnerPerms;
373 break; 328 group &= part.AggregatedInnerGroupPerms;
329 everyone &= part.AggregatedInnerEveryonePerms;
374 } 330 }
375 // recover modify and move 331 // recover modify and move
376 baseperms &= (uint)(PermissionMask.Move | PermissionMask.Modify ); 332 baseOwnerPerms &= movemodmask;
377 current |= baseperms; 333 owner |= baseOwnerPerms;
378 current &= (uint)PermissionMask.All; 334 if((owner & copytransfermast) == 0)
379 m_EffectiveGroupOrEveryOnePerms = current; 335 owner |= (uint)PermissionMask.Transfer;
380 } 336 owner &= allmask;
381 } 337 m_EffectiveOwnerPerms = owner;
382 338
383 private uint m_EffectiveOwnerPerms; 339 // recover modify and move
384 public uint EffectiveOwnerPerms 340 baseGroupPerms &= movemodmask;
385 { 341 group |= baseGroupPerms;
386 get 342 if((group & copytransfermast) == 0)
387 { 343 group |= (uint)PermissionMask.Transfer;
388 // this can't be done here but on every place where a change may happen (rez, (de)link, contents , perms, etc) 344 group &= allmask;
389 // bc this is on heavy duty code paths 345 m_EffectiveGroupPerms = group;
390 // but for now we need to test the concept 346
391 AggregateOwnerPerms(); 347 // recover move
392 return m_EffectiveOwnerPerms; 348 baseEveryonePerms &= (uint)PermissionMask.Move;
349 everyone |= baseEveryonePerms;
350 if((everyone & copytransfermast) == 0) // not much sense but as sl
351 everyone |= (uint)PermissionMask.Transfer;
352 everyone &= allmask;
353 m_EffectiveEveryOnePerms = everyone;
393 } 354 }
394 } 355 }
395 356
396 public void AggregateOwnerPerms() 357 // aggregates perms scanning parts, assuming their contents was already aggregated
358 public void AggregatePerms()
397 { 359 {
398 lock(PermissionsLock) 360 lock(PermissionsLock)
399 { 361 {
400 // get object everyone permissions 362 // aux
401 uint baseperms = RootPart.OwnerMask & (uint)PermissionMask.All; 363 const uint allmask = (uint)PermissionMask.AllEffective;
364 const uint movemodmask = (uint)(PermissionMask.Move | PermissionMask.Modify);
365 const uint copytransfermast = (uint)(PermissionMask.Copy | PermissionMask.Transfer);
366
367 uint baseOwnerPerms = RootPart.OwnerMask;
368 uint owner = baseOwnerPerms;
369 uint baseGroupPerms = RootPart.GroupMask;
370 uint group = baseGroupPerms;
371 uint baseEveryonePerms = RootPart.EveryoneMask;
372 uint everyone = baseEveryonePerms;
402 373
403 if(baseperms == 0)
404 {
405 m_EffectiveOwnerPerms = 0;
406 return;
407 }
408
409 uint current = baseperms;
410 SceneObjectPart[] parts = m_parts.GetArray(); 374 SceneObjectPart[] parts = m_parts.GetArray();
411 for (int i = 0; i < parts.Length; i++) 375 for (int i = 0; i < parts.Length; i++)
412 { 376 {
413 SceneObjectPart part = parts[i]; 377 SceneObjectPart part = parts[i];
414 part.Inventory.AggregateOwnerPerms(ref current); 378 owner &= part.AggregatedInnerOwnerPerms;
415 if( current == 0) 379 group &= part.AggregatedInnerGroupPerms;
416 break; 380 everyone &= part.AggregatedInnerEveryonePerms;
417 } 381 }
418 // recover modify and move 382 // recover modify and move
419 baseperms &= (uint)(PermissionMask.Move | PermissionMask.Modify ); 383 baseOwnerPerms &= movemodmask;
420 current |= baseperms; 384 owner |= baseOwnerPerms;
421 current &= (uint)PermissionMask.All; 385 if((owner & copytransfermast) == 0)
422 if((current & (uint)(PermissionMask.Copy | PermissionMask.Transfer)) == 0) 386 owner |= (uint)PermissionMask.Transfer;
423 current |= (uint)PermissionMask.Transfer; 387 owner &= allmask;
424 m_EffectiveOwnerPerms = current; 388 m_EffectiveOwnerPerms = owner;
389
390 // recover modify and move
391 baseGroupPerms &= movemodmask;
392 group |= baseGroupPerms;
393 if((group & copytransfermast) == 0)
394 group |= (uint)PermissionMask.Transfer;
395 group &= allmask;
396 m_EffectiveGroupPerms = group;
397
398 // recover move
399 baseEveryonePerms &= (uint)PermissionMask.Move;
400 everyone |= baseEveryonePerms;
401 if((everyone & copytransfermast) == 0) // not much sense but as sl
402 everyone |= (uint)PermissionMask.Transfer;
403 everyone &= allmask;
404 m_EffectiveEveryOnePerms = everyone;
425 } 405 }
426 } 406 }
427 407