aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
diff options
context:
space:
mode:
authorAdam Frisby2009-08-16 21:20:45 +1000
committerAdam Frisby2009-08-16 21:20:45 +1000
commit975c49a399d2822b93496d7abea8587c9f8c7af4 (patch)
tree24521a5094bf1ef59e12a4e656671cf784ccb146 /OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-975c49a399d2822b93496d7abea8587c9f8c7af4.zip
opensim-SC-975c49a399d2822b93496d7abea8587c9f8c7af4.tar.gz
opensim-SC-975c49a399d2822b93496d7abea8587c9f8c7af4.tar.bz2
opensim-SC-975c49a399d2822b93496d7abea8587c9f8c7af4.tar.xz
* [MRM] Implements permission checks on IObject implementations in SOPObject.cs. Does not implement security on IObjectInventory yet.
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs86
1 files changed, 77 insertions, 9 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
index fa9ef53..674c9e0 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Security;
30using OpenMetaverse; 31using OpenMetaverse;
31using OpenMetaverse.Packets; 32using OpenMetaverse.Packets;
32using OpenSim.Framework; 33using OpenSim.Framework;
@@ -68,6 +69,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
68 return m_rootScene.GetSceneObjectPart(m_localID); 69 return m_rootScene.GetSceneObjectPart(m_localID);
69 } 70 }
70 71
72 private bool CanEdit()
73 {
74 if(!m_security.CanEditObject(this))
75 {
76 throw new SecurityException("Insufficient Permission to edit object with UUID [" + GetSOP().UUID + "]");
77 }
78 return true;
79 }
80
71 #region OnTouch 81 #region OnTouch
72 82
73 private event OnTouchDelegate _OnTouch; 83 private event OnTouchDelegate _OnTouch;
@@ -139,13 +149,21 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
139 public string Name 149 public string Name
140 { 150 {
141 get { return GetSOP().Name; } 151 get { return GetSOP().Name; }
142 set { GetSOP().Name = value; } 152 set
153 {
154 if (CanEdit())
155 GetSOP().Name = value;
156 }
143 } 157 }
144 158
145 public string Description 159 public string Description
146 { 160 {
147 get { return GetSOP().Description; } 161 get { return GetSOP().Description; }
148 set { GetSOP().Description = value; } 162 set
163 {
164 if (CanEdit())
165 GetSOP().Description = value;
166 }
149 } 167 }
150 168
151 public IObject[] Children 169 public IObject[] Children
@@ -169,7 +187,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
169 187
170 public IObject Root 188 public IObject Root
171 { 189 {
172 get { return new SOPObject(m_rootScene, GetSOP().ParentGroup.RootPart.LocalId); } 190 get { return new SOPObject(m_rootScene, GetSOP().ParentGroup.RootPart.LocalId, m_security); }
173 } 191 }
174 192
175 public IObjectMaterial[] Materials 193 public IObjectMaterial[] Materials
@@ -191,7 +209,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
191 public Vector3 Scale 209 public Vector3 Scale
192 { 210 {
193 get { return GetSOP().Scale; } 211 get { return GetSOP().Scale; }
194 set { GetSOP().Scale = value; } 212 set
213 {
214 if (CanEdit())
215 GetSOP().Scale = value;
216 }
195 } 217 }
196 218
197 public Quaternion WorldRotation 219 public Quaternion WorldRotation
@@ -211,15 +233,24 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
211 get { return GetSOP().AbsolutePosition; } 233 get { return GetSOP().AbsolutePosition; }
212 set 234 set
213 { 235 {
214 SceneObjectPart pos = GetSOP(); 236 if (CanEdit())
215 pos.UpdateOffSet(value - pos.AbsolutePosition); 237 {
238 SceneObjectPart pos = GetSOP();
239 pos.UpdateOffSet(value - pos.AbsolutePosition);
240 }
216 } 241 }
217 } 242 }
218 243
219 public Vector3 OffsetPosition 244 public Vector3 OffsetPosition
220 { 245 {
221 get { return GetSOP().OffsetPosition; } 246 get { return GetSOP().OffsetPosition; }
222 set { GetSOP().OffsetPosition = value; } 247 set
248 {
249 if (CanEdit())
250 {
251 GetSOP().OffsetPosition = value;
252 }
253 }
223 } 254 }
224 255
225 public Vector3 SitTarget 256 public Vector3 SitTarget
@@ -319,8 +350,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
319 350
320 public void Say(string msg) 351 public void Say(string msg)
321 { 352 {
322 SceneObjectPart sop = GetSOP(); 353 if (!CanEdit())
354 return;
323 355
356 SceneObjectPart sop = GetSOP();
324 m_rootScene.SimChat(msg, ChatTypeEnum.Say, sop.AbsolutePosition, sop.Name, sop.UUID, false); 357 m_rootScene.SimChat(msg, ChatTypeEnum.Say, sop.AbsolutePosition, sop.Name, sop.UUID, false);
325 } 358 }
326 359
@@ -512,6 +545,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
512 } 545 }
513 set 546 set
514 { 547 {
548 if (!CanEdit())
549 return;
550
515 GetSOP().PhysActor.RotationalVelocity = new PhysicsVector(value.X, value.Y, value.Z); 551 GetSOP().PhysActor.RotationalVelocity = new PhysicsVector(value.X, value.Y, value.Z);
516 } 552 }
517 } 553 }
@@ -525,6 +561,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
525 } 561 }
526 set 562 set
527 { 563 {
564 if (!CanEdit())
565 return;
566
528 GetSOP().PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z); 567 GetSOP().PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z);
529 } 568 }
530 } 569 }
@@ -538,6 +577,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
538 } 577 }
539 set 578 set
540 { 579 {
580 if (!CanEdit())
581 return;
582
541 GetSOP().PhysActor.Torque = new PhysicsVector(value.X, value.Y, value.Z); 583 GetSOP().PhysActor.Torque = new PhysicsVector(value.X, value.Y, value.Z);
542 } 584 }
543 } 585 }
@@ -560,27 +602,44 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
560 } 602 }
561 set 603 set
562 { 604 {
605 if (!CanEdit())
606 return;
607
563 GetSOP().PhysActor.Force = new PhysicsVector(value.X, value.Y, value.Z); 608 GetSOP().PhysActor.Force = new PhysicsVector(value.X, value.Y, value.Z);
564 } 609 }
565 } 610 }
566 611
567 public bool FloatOnWater 612 public bool FloatOnWater
568 { 613 {
569 set { GetSOP().PhysActor.FloatOnWater = value; } 614 set
615 {
616 if (!CanEdit())
617 return;
618 GetSOP().PhysActor.FloatOnWater = value;
619 }
570 } 620 }
571 621
572 public void AddForce(Vector3 force, bool pushforce) 622 public void AddForce(Vector3 force, bool pushforce)
573 { 623 {
624 if (!CanEdit())
625 return;
626
574 GetSOP().PhysActor.AddForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce); 627 GetSOP().PhysActor.AddForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce);
575 } 628 }
576 629
577 public void AddAngularForce(Vector3 force, bool pushforce) 630 public void AddAngularForce(Vector3 force, bool pushforce)
578 { 631 {
632 if (!CanEdit())
633 return;
634
579 GetSOP().PhysActor.AddAngularForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce); 635 GetSOP().PhysActor.AddAngularForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce);
580 } 636 }
581 637
582 public void SetMomentum(Vector3 momentum) 638 public void SetMomentum(Vector3 momentum)
583 { 639 {
640 if (!CanEdit())
641 return;
642
584 GetSOP().PhysActor.SetMomentum(new PhysicsVector(momentum.X, momentum.Y, momentum.Z)); 643 GetSOP().PhysActor.SetMomentum(new PhysicsVector(momentum.X, momentum.Y, momentum.Z));
585 } 644 }
586 645
@@ -595,6 +654,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
595 get { return m_sculptMap; } 654 get { return m_sculptMap; }
596 set 655 set
597 { 656 {
657 if (!CanEdit())
658 return;
659
598 m_sculptMap = value; 660 m_sculptMap = value;
599 SetPrimitiveSculpted(SculptMap, (byte) SculptType); 661 SetPrimitiveSculpted(SculptMap, (byte) SculptType);
600 } 662 }
@@ -607,6 +669,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
607 get { return m_sculptType; } 669 get { return m_sculptType; }
608 set 670 set
609 { 671 {
672 if(!CanEdit())
673 return;
674
610 m_sculptType = value; 675 m_sculptType = value;
611 SetPrimitiveSculpted(SculptMap, (byte) SculptType); 676 SetPrimitiveSculpted(SculptMap, (byte) SculptType);
612 } 677 }
@@ -663,6 +728,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
663 728
664 public void Play(UUID asset, double volume) 729 public void Play(UUID asset, double volume)
665 { 730 {
731 if (!CanEdit())
732 return;
733
666 GetSOP().SendSound(asset.ToString(), volume, true, 0); 734 GetSOP().SendSound(asset.ToString(), volume, true, 0);
667 } 735 }
668 736