aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Scripting/Minimodule
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/Minimodule')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs29
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs13
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs15
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs105
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs8
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatarAttachment.cs7
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs45
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs8
10 files changed, 192 insertions, 42 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs
index 464723e..533d176 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs
@@ -1,7 +1,36 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
1namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 28namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
2{ 29{
3 public interface ISecurityCredential 30 public interface ISecurityCredential
4 { 31 {
5 ISocialEntity owner { get; } 32 ISocialEntity owner { get; }
33 bool CanEditObject(IObject target);
34 bool CanEditTerrain(int x, int y);
6 } 35 }
7} \ No newline at end of file 36} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs
index 849e3ca..03c1e95 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs
@@ -32,19 +32,6 @@ using OpenMetaverse;
32 32
33namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 33namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
34{ 34{
35 public interface IAvatarAttachment
36 {
37 //// <value>
38 /// Describes where on the avatar the attachment is located
39 /// </value>
40 int Location { get ; }
41
42 //// <value>
43 /// Accessor to the rez'ed asset, representing the attachment
44 /// </value>
45 IObject Asset { get; }
46 }
47
48 public interface IAvatar : IEntity 35 public interface IAvatar : IEntity
49 { 36 {
50 //// <value> 37 //// <value>
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs
new file mode 100644
index 0000000..22b4605
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs
@@ -0,0 +1,15 @@
1namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
2{
3 public interface IAvatarAttachment
4 {
5 //// <value>
6 /// Describes where on the avatar the attachment is located
7 /// </value>
8 int Location { get ; }
9
10 //// <value>
11 /// Accessor to the rez'ed asset, representing the attachment
12 /// </value>
13 IObject Asset { get; }
14 }
15} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs
index 6415250..19f7210 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs
@@ -212,6 +212,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
212 bool Bright { get; set; } // SetPrimParms(FULLBRIGHT) 212 bool Bright { get; set; } // SetPrimParms(FULLBRIGHT)
213 double Bloom { get; set; } // SetPrimParms(GLOW) 213 double Bloom { get; set; } // SetPrimParms(GLOW)
214 bool Shiny { get; set; } // SetPrimParms(SHINY) 214 bool Shiny { get; set; } // SetPrimParms(SHINY)
215 bool BumpMap { get; set; } // SetPrimParms(BUMPMAP) [DEPRECIATE IN FAVOUR OF UUID?] 215 bool BumpMap { get; set; } // SetPrimParms(BUMPMAP) [DEPRECATE IN FAVOUR OF UUID?]
216 } 216 }
217} 217}
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
index 0cc7930..6daae29 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
@@ -169,7 +169,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
169 // UUID should be changed to object owner. 169 // UUID should be changed to object owner.
170 UUID owner = m_scene.RegionInfo.MasterAvatarAssignedUUID; 170 UUID owner = m_scene.RegionInfo.MasterAvatarAssignedUUID;
171 SEUser securityUser = new SEUser(owner, "Name Unassigned"); 171 SEUser securityUser = new SEUser(owner, "Name Unassigned");
172 SecurityCredential creds = new SecurityCredential(securityUser); 172 SecurityCredential creds = new SecurityCredential(securityUser, m_scene);
173 173
174 world = new World(m_scene, creds); 174 world = new World(m_scene, creds);
175 host = new Host(new SOPObject(m_scene, localID, creds), m_scene, new ExtensionHandler(m_extensions), 175 host = new Host(new SOPObject(m_scene, localID, creds), m_scene, new ExtensionHandler(m_extensions),
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
index fa9ef53..35b0a0f 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;
@@ -77,14 +87,17 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
77 { 87 {
78 add 88 add
79 { 89 {
80 if (!_OnTouchActive) 90 if (CanEdit())
81 { 91 {
82 GetSOP().Flags |= PrimFlags.Touch; 92 if (!_OnTouchActive)
83 _OnTouchActive = true; 93 {
84 m_rootScene.EventManager.OnObjectGrab += EventManager_OnObjectGrab; 94 GetSOP().Flags |= PrimFlags.Touch;
95 _OnTouchActive = true;
96 m_rootScene.EventManager.OnObjectGrab += EventManager_OnObjectGrab;
97 }
98
99 _OnTouch += value;
85 } 100 }
86
87 _OnTouch += value;
88 } 101 }
89 remove 102 remove
90 { 103 {
@@ -104,7 +117,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
104 if (_OnTouchActive && m_localID == localID) 117 if (_OnTouchActive && m_localID == localID)
105 { 118 {
106 TouchEventArgs e = new TouchEventArgs(); 119 TouchEventArgs e = new TouchEventArgs();
107 e.Avatar = new SPAvatar(m_rootScene, remoteClient.AgentId); 120 e.Avatar = new SPAvatar(m_rootScene, remoteClient.AgentId, m_security);
108 e.TouchBiNormal = surfaceArgs.Binormal; 121 e.TouchBiNormal = surfaceArgs.Binormal;
109 e.TouchMaterialIndex = surfaceArgs.FaceIndex; 122 e.TouchMaterialIndex = surfaceArgs.FaceIndex;
110 e.TouchNormal = surfaceArgs.Normal; 123 e.TouchNormal = surfaceArgs.Normal;
@@ -139,13 +152,21 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
139 public string Name 152 public string Name
140 { 153 {
141 get { return GetSOP().Name; } 154 get { return GetSOP().Name; }
142 set { GetSOP().Name = value; } 155 set
156 {
157 if (CanEdit())
158 GetSOP().Name = value;
159 }
143 } 160 }
144 161
145 public string Description 162 public string Description
146 { 163 {
147 get { return GetSOP().Description; } 164 get { return GetSOP().Description; }
148 set { GetSOP().Description = value; } 165 set
166 {
167 if (CanEdit())
168 GetSOP().Description = value;
169 }
149 } 170 }
150 171
151 public IObject[] Children 172 public IObject[] Children
@@ -160,7 +181,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
160 int i = 0; 181 int i = 0;
161 foreach (KeyValuePair<UUID, SceneObjectPart> pair in my.ParentGroup.Children) 182 foreach (KeyValuePair<UUID, SceneObjectPart> pair in my.ParentGroup.Children)
162 { 183 {
163 rets[i++] = new SOPObject(m_rootScene, pair.Value.LocalId); 184 rets[i++] = new SOPObject(m_rootScene, pair.Value.LocalId, m_security);
164 } 185 }
165 186
166 return rets; 187 return rets;
@@ -169,7 +190,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
169 190
170 public IObject Root 191 public IObject Root
171 { 192 {
172 get { return new SOPObject(m_rootScene, GetSOP().ParentGroup.RootPart.LocalId); } 193 get { return new SOPObject(m_rootScene, GetSOP().ParentGroup.RootPart.LocalId, m_security); }
173 } 194 }
174 195
175 public IObjectMaterial[] Materials 196 public IObjectMaterial[] Materials
@@ -191,7 +212,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
191 public Vector3 Scale 212 public Vector3 Scale
192 { 213 {
193 get { return GetSOP().Scale; } 214 get { return GetSOP().Scale; }
194 set { GetSOP().Scale = value; } 215 set
216 {
217 if (CanEdit())
218 GetSOP().Scale = value;
219 }
195 } 220 }
196 221
197 public Quaternion WorldRotation 222 public Quaternion WorldRotation
@@ -211,15 +236,24 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
211 get { return GetSOP().AbsolutePosition; } 236 get { return GetSOP().AbsolutePosition; }
212 set 237 set
213 { 238 {
214 SceneObjectPart pos = GetSOP(); 239 if (CanEdit())
215 pos.UpdateOffSet(value - pos.AbsolutePosition); 240 {
241 SceneObjectPart pos = GetSOP();
242 pos.UpdateOffSet(value - pos.AbsolutePosition);
243 }
216 } 244 }
217 } 245 }
218 246
219 public Vector3 OffsetPosition 247 public Vector3 OffsetPosition
220 { 248 {
221 get { return GetSOP().OffsetPosition; } 249 get { return GetSOP().OffsetPosition; }
222 set { GetSOP().OffsetPosition = value; } 250 set
251 {
252 if (CanEdit())
253 {
254 GetSOP().OffsetPosition = value;
255 }
256 }
223 } 257 }
224 258
225 public Vector3 SitTarget 259 public Vector3 SitTarget
@@ -319,8 +353,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
319 353
320 public void Say(string msg) 354 public void Say(string msg)
321 { 355 {
322 SceneObjectPart sop = GetSOP(); 356 if (!CanEdit())
357 return;
323 358
359 SceneObjectPart sop = GetSOP();
324 m_rootScene.SimChat(msg, ChatTypeEnum.Say, sop.AbsolutePosition, sop.Name, sop.UUID, false); 360 m_rootScene.SimChat(msg, ChatTypeEnum.Say, sop.AbsolutePosition, sop.Name, sop.UUID, false);
325 } 361 }
326 362
@@ -512,6 +548,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
512 } 548 }
513 set 549 set
514 { 550 {
551 if (!CanEdit())
552 return;
553
515 GetSOP().PhysActor.RotationalVelocity = new PhysicsVector(value.X, value.Y, value.Z); 554 GetSOP().PhysActor.RotationalVelocity = new PhysicsVector(value.X, value.Y, value.Z);
516 } 555 }
517 } 556 }
@@ -525,6 +564,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
525 } 564 }
526 set 565 set
527 { 566 {
567 if (!CanEdit())
568 return;
569
528 GetSOP().PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z); 570 GetSOP().PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z);
529 } 571 }
530 } 572 }
@@ -538,6 +580,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
538 } 580 }
539 set 581 set
540 { 582 {
583 if (!CanEdit())
584 return;
585
541 GetSOP().PhysActor.Torque = new PhysicsVector(value.X, value.Y, value.Z); 586 GetSOP().PhysActor.Torque = new PhysicsVector(value.X, value.Y, value.Z);
542 } 587 }
543 } 588 }
@@ -560,27 +605,44 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
560 } 605 }
561 set 606 set
562 { 607 {
608 if (!CanEdit())
609 return;
610
563 GetSOP().PhysActor.Force = new PhysicsVector(value.X, value.Y, value.Z); 611 GetSOP().PhysActor.Force = new PhysicsVector(value.X, value.Y, value.Z);
564 } 612 }
565 } 613 }
566 614
567 public bool FloatOnWater 615 public bool FloatOnWater
568 { 616 {
569 set { GetSOP().PhysActor.FloatOnWater = value; } 617 set
618 {
619 if (!CanEdit())
620 return;
621 GetSOP().PhysActor.FloatOnWater = value;
622 }
570 } 623 }
571 624
572 public void AddForce(Vector3 force, bool pushforce) 625 public void AddForce(Vector3 force, bool pushforce)
573 { 626 {
627 if (!CanEdit())
628 return;
629
574 GetSOP().PhysActor.AddForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce); 630 GetSOP().PhysActor.AddForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce);
575 } 631 }
576 632
577 public void AddAngularForce(Vector3 force, bool pushforce) 633 public void AddAngularForce(Vector3 force, bool pushforce)
578 { 634 {
635 if (!CanEdit())
636 return;
637
579 GetSOP().PhysActor.AddAngularForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce); 638 GetSOP().PhysActor.AddAngularForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce);
580 } 639 }
581 640
582 public void SetMomentum(Vector3 momentum) 641 public void SetMomentum(Vector3 momentum)
583 { 642 {
643 if (!CanEdit())
644 return;
645
584 GetSOP().PhysActor.SetMomentum(new PhysicsVector(momentum.X, momentum.Y, momentum.Z)); 646 GetSOP().PhysActor.SetMomentum(new PhysicsVector(momentum.X, momentum.Y, momentum.Z));
585 } 647 }
586 648
@@ -595,6 +657,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
595 get { return m_sculptMap; } 657 get { return m_sculptMap; }
596 set 658 set
597 { 659 {
660 if (!CanEdit())
661 return;
662
598 m_sculptMap = value; 663 m_sculptMap = value;
599 SetPrimitiveSculpted(SculptMap, (byte) SculptType); 664 SetPrimitiveSculpted(SculptMap, (byte) SculptType);
600 } 665 }
@@ -607,6 +672,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
607 get { return m_sculptType; } 672 get { return m_sculptType; }
608 set 673 set
609 { 674 {
675 if(!CanEdit())
676 return;
677
610 m_sculptType = value; 678 m_sculptType = value;
611 SetPrimitiveSculpted(SculptMap, (byte) SculptType); 679 SetPrimitiveSculpted(SculptMap, (byte) SculptType);
612 } 680 }
@@ -663,6 +731,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
663 731
664 public void Play(UUID asset, double volume) 732 public void Play(UUID asset, double volume)
665 { 733 {
734 if (!CanEdit())
735 return;
736
666 GetSOP().SendSound(asset.ToString(), volume, true, 0); 737 GetSOP().SendSound(asset.ToString(), volume, true, 0);
667 } 738 }
668 739
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs
index ce2d339..4600836 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs
@@ -42,11 +42,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
42 { 42 {
43 private readonly Scene m_rootScene; 43 private readonly Scene m_rootScene;
44 private readonly UUID m_ID; 44 private readonly UUID m_ID;
45 private readonly ISecurityCredential m_security;
45 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 47
47 public SPAvatar(Scene scene, UUID ID) 48 public SPAvatar(Scene scene, UUID ID, ISecurityCredential security)
48 { 49 {
49 m_rootScene = scene; 50 m_rootScene = scene;
51 m_security = security;
50 m_ID = ID; 52 m_ID = ID;
51 } 53 }
52 54
@@ -84,7 +86,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
84 foreach (DictionaryEntry element in internalAttachments) 86 foreach (DictionaryEntry element in internalAttachments)
85 { 87 {
86 Hashtable attachInfo = (Hashtable)element.Value; 88 Hashtable attachInfo = (Hashtable)element.Value;
87 attachments.Add(new SPAvatarAttachment(m_rootScene, this, (int)element.Key, new UUID((string)attachInfo["item"]), new UUID((string)attachInfo["asset"]))); 89 attachments.Add(new SPAvatarAttachment(m_rootScene, this, (int) element.Key,
90 new UUID((string) attachInfo["item"]),
91 new UUID((string) attachInfo["asset"]), m_security));
88 } 92 }
89 } 93 }
90 94
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatarAttachment.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatarAttachment.cs
index 9b684fe..570459a 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatarAttachment.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatarAttachment.cs
@@ -39,10 +39,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
39 private readonly int m_location; 39 private readonly int m_location;
40 //private readonly UUID m_itemId; 40 //private readonly UUID m_itemId;
41 private readonly UUID m_assetId; 41 private readonly UUID m_assetId;
42
43 private readonly ISecurityCredential m_security;
42 44
43 public SPAvatarAttachment(Scene rootScene, IAvatar self, int location, UUID itemId, UUID assetId) 45 public SPAvatarAttachment(Scene rootScene, IAvatar self, int location, UUID itemId, UUID assetId, ISecurityCredential security)
44 { 46 {
45 m_rootScene = rootScene; 47 m_rootScene = rootScene;
48 m_security = security;
46 //m_parent = self; 49 //m_parent = self;
47 m_location = location; 50 m_location = location;
48 //m_itemId = itemId; 51 //m_itemId = itemId;
@@ -55,7 +58,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
55 { 58 {
56 get 59 get
57 { 60 {
58 return new SOPObject(m_rootScene, m_rootScene.GetSceneObjectPart(m_assetId).LocalId); 61 return new SOPObject(m_rootScene, m_rootScene.GetSceneObjectPart(m_assetId).LocalId, m_security);
59 } 62 }
60 } 63 }
61 } 64 }
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs
index bd4440c..bc7f6cb 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs
@@ -1,21 +1,62 @@
1using System; 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
2using System.Collections.Generic; 29using System.Collections.Generic;
3using System.Text; 30using System.Text;
31using OpenMetaverse;
32using OpenSim.Region.Framework.Scenes;
4 33
5namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 34namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
6{ 35{
7 class SecurityCredential : ISecurityCredential 36 class SecurityCredential : ISecurityCredential
8 { 37 {
9 private readonly ISocialEntity m_owner; 38 private readonly ISocialEntity m_owner;
39 private readonly Scene m_scene;
10 40
11 public SecurityCredential(ISocialEntity m_owner) 41 public SecurityCredential(ISocialEntity m_owner, Scene m_scene)
12 { 42 {
13 this.m_owner = m_owner; 43 this.m_owner = m_owner;
44 this.m_scene = m_scene;
14 } 45 }
15 46
16 public ISocialEntity owner 47 public ISocialEntity owner
17 { 48 {
18 get { return m_owner; } 49 get { return m_owner; }
19 } 50 }
51
52 public bool CanEditObject(IObject target)
53 {
54 return m_scene.Permissions.CanEditObject(target.GlobalID, m_owner.GlobalID);
55 }
56
57 public bool CanEditTerrain(int x, int y)
58 {
59 return m_scene.Permissions.CanTerraformLand(m_owner.GlobalID, new Vector3(x, y, 0));
60 }
20 } 61 }
21} 62}
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
index a34684f..da5ea0d 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
86 if (_OnNewUser != null) 86 if (_OnNewUser != null)
87 { 87 {
88 NewUserEventArgs e = new NewUserEventArgs(); 88 NewUserEventArgs e = new NewUserEventArgs();
89 e.Avatar = new SPAvatar(m_internalScene, presence.UUID); 89 e.Avatar = new SPAvatar(m_internalScene, presence.UUID, m_security);
90 _OnNewUser(this, e); 90 _OnNewUser(this, e);
91 } 91 }
92 } 92 }
@@ -146,7 +146,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
146 if (chat.Sender == null && chat.SenderObject != null) 146 if (chat.Sender == null && chat.SenderObject != null)
147 { 147 {
148 ChatEventArgs e = new ChatEventArgs(); 148 ChatEventArgs e = new ChatEventArgs();
149 e.Sender = new SOPObject(m_internalScene, ((SceneObjectPart) chat.SenderObject).LocalId); 149 e.Sender = new SOPObject(m_internalScene, ((SceneObjectPart) chat.SenderObject).LocalId, m_security);
150 e.Text = chat.Message; 150 e.Text = chat.Message;
151 151
152 _OnChat(this, e); 152 _OnChat(this, e);
@@ -156,7 +156,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
156 if (chat.Sender != null && chat.SenderObject == null) 156 if (chat.Sender != null && chat.SenderObject == null)
157 { 157 {
158 ChatEventArgs e = new ChatEventArgs(); 158 ChatEventArgs e = new ChatEventArgs();
159 e.Sender = new SPAvatar(m_internalScene, chat.SenderUUID); 159 e.Sender = new SPAvatar(m_internalScene, chat.SenderUUID, m_security);
160 e.Text = chat.Message; 160 e.Text = chat.Message;
161 161
162 _OnChat(this, e); 162 _OnChat(this, e);
@@ -209,7 +209,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
209 for (int i = 0; i < ents.Count; i++) 209 for (int i = 0; i < ents.Count; i++)
210 { 210 {
211 EntityBase ent = ents[i]; 211 EntityBase ent = ents[i];
212 rets[i] = new SPAvatar(m_internalScene, ent.UUID); 212 rets[i] = new SPAvatar(m_internalScene, ent.UUID, m_security);
213 } 213 }
214 214
215 return rets; 215 return rets;