aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
authorAdam Frisby2009-08-16 03:48:16 +1000
committerAdam Frisby2009-08-16 03:48:16 +1000
commit9090a907692e7deaafd79150bf6482507be86d55 (patch)
tree487252fb365fde827f77b5599a0cc9cfed20c8ae /OpenSim/Region/OptionalModules
parentDeal with possible race in TestAddNeighborRegion in ScenePresenceTests (diff)
downloadopensim-SC-9090a907692e7deaafd79150bf6482507be86d55.zip
opensim-SC-9090a907692e7deaafd79150bf6482507be86d55.tar.gz
opensim-SC-9090a907692e7deaafd79150bf6482507be86d55.tar.bz2
opensim-SC-9090a907692e7deaafd79150bf6482507be86d55.tar.xz
* Beginnings of a Security Credential system in MRM. This will eventually lead to trusted execution of untrusted MRMs.
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs7
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs10
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs22
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs9
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs21
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs6
6 files changed, 62 insertions, 13 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs
new file mode 100644
index 0000000..464723e
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs
@@ -0,0 +1,7 @@
1namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
2{
3 public interface ISecurityCredential
4 {
5 ISocialEntity owner { get; }
6 }
7} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
index 5ed9af3..0cc7930 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
@@ -166,8 +166,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
166 166
167 public void GetGlobalEnvironment(uint localID, out IWorld world, out IHost host) 167 public void GetGlobalEnvironment(uint localID, out IWorld world, out IHost host)
168 { 168 {
169 world = new World(m_scene); 169 // UUID should be changed to object owner.
170 host = new Host(new SOPObject(m_scene, localID), m_scene, new ExtensionHandler(m_extensions), m_microthreads); 170 UUID owner = m_scene.RegionInfo.MasterAvatarAssignedUUID;
171 SEUser securityUser = new SEUser(owner, "Name Unassigned");
172 SecurityCredential creds = new SecurityCredential(securityUser);
173
174 world = new World(m_scene, creds);
175 host = new Host(new SOPObject(m_scene, localID, creds), m_scene, new ExtensionHandler(m_extensions),
176 m_microthreads);
171 } 177 }
172 178
173 public void InitializeMRM(MRMBase mmb, uint localID, UUID itemID) 179 public void InitializeMRM(MRMBase mmb, uint localID, UUID itemID)
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs
index 4638ad0..6ba5ccf 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs
@@ -40,10 +40,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
40 { 40 {
41 private readonly Scene m_scene; 41 private readonly Scene m_scene;
42 private readonly IEnumerator<EntityBase> m_sogEnum; 42 private readonly IEnumerator<EntityBase> m_sogEnum;
43 private readonly ISecurityCredential m_security;
43 44
44 public IObjEnum(Scene scene) 45 public IObjEnum(Scene scene, ISecurityCredential security)
45 { 46 {
46 m_scene = scene; 47 m_scene = scene;
48 m_security = security;
47 m_sogEnum = m_scene.Entities.GetAllByType<SceneObjectGroup>().GetEnumerator(); 49 m_sogEnum = m_scene.Entities.GetAllByType<SceneObjectGroup>().GetEnumerator();
48 } 50 }
49 51
@@ -66,7 +68,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
66 { 68 {
67 get 69 get
68 { 70 {
69 return new SOPObject(m_scene, m_sogEnum.Current.LocalId); 71 return new SOPObject(m_scene, m_sogEnum.Current.LocalId, m_security);
70 } 72 }
71 } 73 }
72 74
@@ -79,17 +81,19 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
79 public class ObjectAccessor : System.MarshalByRefObject, IObjectAccessor 81 public class ObjectAccessor : System.MarshalByRefObject, IObjectAccessor
80 { 82 {
81 private readonly Scene m_scene; 83 private readonly Scene m_scene;
84 private readonly ISecurityCredential m_security;
82 85
83 public ObjectAccessor(Scene scene) 86 public ObjectAccessor(Scene scene, ISecurityCredential security)
84 { 87 {
85 m_scene = scene; 88 m_scene = scene;
89 m_security = security;
86 } 90 }
87 91
88 public IObject this[int index] 92 public IObject this[int index]
89 { 93 {
90 get 94 get
91 { 95 {
92 return new SOPObject(m_scene, m_scene.Entities[(uint)index].LocalId); 96 return new SOPObject(m_scene, m_scene.Entities[(uint)index].LocalId, m_security);
93 } 97 }
94 } 98 }
95 99
@@ -97,7 +101,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
97 { 101 {
98 get 102 get
99 { 103 {
100 return new SOPObject(m_scene, m_scene.Entities[index].LocalId); 104 return new SOPObject(m_scene, m_scene.Entities[index].LocalId, m_security);
101 } 105 }
102 } 106 }
103 107
@@ -105,7 +109,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
105 { 109 {
106 get 110 get
107 { 111 {
108 return new SOPObject(m_scene, m_scene.Entities[index].LocalId); 112 return new SOPObject(m_scene, m_scene.Entities[index].LocalId, m_security);
109 } 113 }
110 } 114 }
111 115
@@ -117,20 +121,20 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
117 public IObject Create(Vector3 position, Quaternion rotation) 121 public IObject Create(Vector3 position, Quaternion rotation)
118 { 122 {
119 123
120 SceneObjectGroup sog = m_scene.AddNewPrim(m_scene.RegionInfo.MasterAvatarAssignedUUID, 124 SceneObjectGroup sog = m_scene.AddNewPrim(m_security.owner.GlobalID,
121 UUID.Zero, 125 UUID.Zero,
122 position, 126 position,
123 rotation, 127 rotation,
124 PrimitiveBaseShape.CreateBox()); 128 PrimitiveBaseShape.CreateBox());
125 129
126 IObject ret = new SOPObject(m_scene, sog.LocalId); 130 IObject ret = new SOPObject(m_scene, sog.LocalId, m_security);
127 131
128 return ret; 132 return ret;
129 } 133 }
130 134
131 public IEnumerator<IObject> GetEnumerator() 135 public IEnumerator<IObject> GetEnumerator()
132 { 136 {
133 return new IObjEnum(m_scene); 137 return new IObjEnum(m_scene, m_security);
134 } 138 }
135 139
136 IEnumerator IEnumerable.GetEnumerator() 140 IEnumerator IEnumerable.GetEnumerator()
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
index bc26389..fa9ef53 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
@@ -42,13 +42,22 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
42 { 42 {
43 private readonly Scene m_rootScene; 43 private readonly Scene m_rootScene;
44 private readonly uint m_localID; 44 private readonly uint m_localID;
45 private readonly ISecurityCredential m_security;
45 46
47 [Obsolete("Replace with 'credential' constructor [security]")]
46 public SOPObject(Scene rootScene, uint localID) 48 public SOPObject(Scene rootScene, uint localID)
47 { 49 {
48 m_rootScene = rootScene; 50 m_rootScene = rootScene;
49 m_localID = localID; 51 m_localID = localID;
50 } 52 }
51 53
54 public SOPObject(Scene rootScene, uint localID, ISecurityCredential credential)
55 {
56 m_rootScene = rootScene;
57 m_localID = localID;
58 m_security = credential;
59 }
60
52 /// <summary> 61 /// <summary>
53 /// This needs to run very, very quickly. 62 /// This needs to run very, very quickly.
54 /// It is utilized in nearly every property and method. 63 /// It is utilized in nearly every property and method.
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs
new file mode 100644
index 0000000..bd4440c
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs
@@ -0,0 +1,21 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
6{
7 class SecurityCredential : ISecurityCredential
8 {
9 private readonly ISocialEntity m_owner;
10
11 public SecurityCredential(ISocialEntity m_owner)
12 {
13 this.m_owner = m_owner;
14 }
15
16 public ISocialEntity owner
17 {
18 get { return m_owner; }
19 }
20 }
21}
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
index 1ec4a33..a34684f 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
@@ -37,15 +37,17 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
37 public class World : System.MarshalByRefObject, IWorld, IWorldAudio 37 public class World : System.MarshalByRefObject, IWorld, IWorldAudio
38 { 38 {
39 private readonly Scene m_internalScene; 39 private readonly Scene m_internalScene;
40 private readonly ISecurityCredential m_security;
40 private readonly Heightmap m_heights; 41 private readonly Heightmap m_heights;
41 42
42 private readonly ObjectAccessor m_objs; 43 private readonly ObjectAccessor m_objs;
43 44
44 public World(Scene internalScene) 45 public World(Scene internalScene, ISecurityCredential securityCredential)
45 { 46 {
47 m_security = securityCredential;
46 m_internalScene = internalScene; 48 m_internalScene = internalScene;
47 m_heights = new Heightmap(m_internalScene); 49 m_heights = new Heightmap(m_internalScene);
48 m_objs = new ObjectAccessor(m_internalScene); 50 m_objs = new ObjectAccessor(m_internalScene, securityCredential);
49 } 51 }
50 52
51 #region Events 53 #region Events