aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/PermissionManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/PermissionManager.cs')
-rw-r--r--OpenSim/Region/Environment/PermissionManager.cs104
1 files changed, 51 insertions, 53 deletions
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs
index 47e29a3..7805c78 100644
--- a/OpenSim/Region/Environment/PermissionManager.cs
+++ b/OpenSim/Region/Environment/PermissionManager.cs
@@ -37,12 +37,12 @@ namespace OpenSim.Region.Environment
37 protected Scene m_scene; 37 protected Scene m_scene;
38 38
39 // These are here for testing. They will be taken out 39 // These are here for testing. They will be taken out
40 private uint PERM_ALL = (uint) 2147483647; 40 private uint PERM_ALL = (uint)2147483647;
41 private uint PERM_COPY = (uint) 32768; 41 private uint PERM_COPY = (uint)32768;
42 private uint PERM_MODIFY = (uint) 16384; 42 private uint PERM_MODIFY = (uint)16384;
43 private uint PERM_MOVE = (uint) 524288; 43 private uint PERM_MOVE = (uint)524288;
44 private uint PERM_TRANS = (uint) 8192; 44 private uint PERM_TRANS = (uint)8192;
45 private uint PERM_LOCKED = (uint) 540672; 45 private uint PERM_LOCKED = (uint)540672;
46 // Bypasses the permissions engine (always returns OK) 46 // Bypasses the permissions engine (always returns OK)
47 // disable in any production environment 47 // disable in any production environment
48 // TODO: Change this to false when permissions are a desired default 48 // TODO: Change this to false when permissions are a desired default
@@ -108,7 +108,7 @@ namespace OpenSim.Region.Environment
108 // The below is commented out because logically it happens anyway. It's left in for readability 108 // The below is commented out because logically it happens anyway. It's left in for readability
109 //else 109 //else
110 //{ 110 //{
111 //return false; 111 //return false;
112 //} 112 //}
113 113
114 return false; 114 return false;
@@ -133,8 +133,8 @@ namespace OpenSim.Region.Environment
133 Land land = m_scene.LandManager.getLandObject(position.X, position.Y); 133 Land land = m_scene.LandManager.getLandObject(position.X, position.Y);
134 if (land == null) return false; 134 if (land == null) return false;
135 135
136 if ((land.landData.landFlags & ((int) Parcel.ParcelFlags.CreateObjects)) == 136 if ((land.landData.landFlags & ((int)Parcel.ParcelFlags.CreateObjects)) ==
137 (int) Parcel.ParcelFlags.CreateObjects) 137 (int)Parcel.ParcelFlags.CreateObjects)
138 permission = true; 138 permission = true;
139 139
140 //TODO: check for group rights 140 //TODO: check for group rights
@@ -190,25 +190,23 @@ namespace OpenSim.Region.Environment
190 return 0; 190 return 0;
191 } 191 }
192 192
193 SceneObjectGroup task = (SceneObjectGroup) m_scene.Entities[objID]; 193 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[objID];
194 LLUUID taskOwner = null;
195 // Added this because at this point in time it wouldn't be wise for
196 // the administrator object permissions to take effect.
197 LLUUID objectOwner = task.OwnerID; 194 LLUUID objectOwner = task.OwnerID;
198 195
199 uint objflags = task.RootPart.ObjectFlags; 196 uint objflags = task.RootPart.ObjectFlags;
200 197
201 198
202 // Remove any of the objectFlags that are temporary. These will get added back if appropriate 199 // Remove any of the objectFlags that are temporary. These will get added back if appropriate
203 // in the next bit of code 200 // in the next bit of code
204 201
205 objflags &= ~(uint)LLObject.ObjectFlags.ObjectCopy; // Tells client you can copy the object 202 objflags &= (uint)
206 objflags &= ~(uint)LLObject.ObjectFlags.ObjectModify; // tells client you can modify the object 203 ~(LLObject.ObjectFlags.ObjectCopy | // Tells client you can copy the object
207 objflags &= ~(uint)LLObject.ObjectFlags.ObjectMove; // tells client that you can move the object (only, no mod) 204 LLObject.ObjectFlags.ObjectModify | // tells client you can modify the object
208 objflags &= ~(uint)LLObject.ObjectFlags.ObjectTransfer; // tells the client that you can /take/ the object if you don't own it 205 LLObject.ObjectFlags.ObjectMove | // tells client that you can move the object (only, no mod)
209 objflags &= ~(uint)LLObject.ObjectFlags.ObjectYouOwner; // Tells client that you're the owner of the object 206 LLObject.ObjectFlags.ObjectTransfer | // tells the client that you can /take/ the object if you don't own it
210 objflags &= ~(uint)LLObject.ObjectFlags.ObjectYouOfficer; // Tells client that you've got group object editing permission. Used when ObjectGroupOwned is set 207 LLObject.ObjectFlags.ObjectYouOwner | // Tells client that you're the owner of the object
211 208 LLObject.ObjectFlags.ObjectYouOfficer // Tells client that you've got group object editing permission. Used when ObjectGroupOwned is set
209 );
212 210
213 // Creating the three ObjectFlags options for this method to choose from. 211 // Creating the three ObjectFlags options for this method to choose from.
214 // Customize the OwnerMask 212 // Customize the OwnerMask
@@ -217,10 +215,10 @@ namespace OpenSim.Region.Environment
217 215
218 // Customize the GroupMask 216 // Customize the GroupMask
219 uint objectGroupMask = ApplyObjectModifyMasks(task.RootPart.GroupMask, objflags); 217 uint objectGroupMask = ApplyObjectModifyMasks(task.RootPart.GroupMask, objflags);
220 218
221 // Customize the EveryoneMask 219 // Customize the EveryoneMask
222 uint objectEveryoneMask = ApplyObjectModifyMasks(task.RootPart.EveryoneMask, objflags); 220 uint objectEveryoneMask = ApplyObjectModifyMasks(task.RootPart.EveryoneMask, objflags);
223 221
224 222
225 // Hack to allow collaboration until Groups and Group Permissions are implemented 223 // Hack to allow collaboration until Groups and Group Permissions are implemented
226 if ((objectEveryoneMask & (uint)LLObject.ObjectFlags.ObjectMove) != 0) 224 if ((objectEveryoneMask & (uint)LLObject.ObjectFlags.ObjectMove) != 0)
@@ -239,16 +237,16 @@ namespace OpenSim.Region.Environment
239 Land parcel = m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y); 237 Land parcel = m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
240 if (parcel != null && parcel.landData.ownerID == user) 238 if (parcel != null && parcel.landData.ownerID == user)
241 return objectOwnerMask; 239 return objectOwnerMask;
242 240
243 // Admin objects should not be editable by the above 241 // Admin objects should not be editable by the above
244 if (IsAdministrator(objectOwner)) 242 if (IsAdministrator(objectOwner))
245 return objectEveryoneMask; 243 return objectEveryoneMask;
246 244
247 // Estate users should be able to edit anything in the sim 245 // Estate users should be able to edit anything in the sim
248 if (IsEstateManager(user)) 246 if (IsEstateManager(user))
249 return objectOwnerMask; 247 return objectOwnerMask;
250 248
251 249
252 250
253 // Admin should be able to edit anything in the sim (including admin objects) 251 // Admin should be able to edit anything in the sim (including admin objects)
254 if (IsAdministrator(user)) 252 if (IsAdministrator(user))
@@ -257,37 +255,37 @@ namespace OpenSim.Region.Environment
257 255
258 return objectEveryoneMask; 256 return objectEveryoneMask;
259 } 257 }
260 258
261 259
262 260
263 private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask) 261 private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask)
264 { 262 {
265 // We are adding the temporary objectflags to the object's objectflags based on the 263 // We are adding the temporary objectflags to the object's objectflags based on the
266 // permission flag given. These change the F flags on the client. 264 // permission flag given. These change the F flags on the client.
267
268 if ((setPermissionMask & (uint)PermissionMask.Copy) != 0)
269 {
270 objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectCopy;
271 }
272 265
273 if ((setPermissionMask & (uint)PermissionMask.Move) != 0) 266 if ((setPermissionMask & (uint)PermissionMask.Copy) != 0)
274 { 267 {
275 objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectMove; 268 objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectCopy;
276 } 269 }
277 270
278 if ((setPermissionMask & (uint)PermissionMask.Modify) != 0) 271 if ((setPermissionMask & (uint)PermissionMask.Move) != 0)
279 { 272 {
280 objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectModify; 273 objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectMove;
281 } 274 }
275
276 if ((setPermissionMask & (uint)PermissionMask.Modify) != 0)
277 {
278 objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectModify;
279 }
280
281 if ((setPermissionMask & (uint)PermissionMask.Transfer) != 0)
282 {
283 objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectTransfer;
284 }
282 285
283 if ((setPermissionMask & (uint)PermissionMask.Transfer) != 0)
284 {
285 objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectTransfer;
286 }
287
288 return objectFlagsMask; 286 return objectFlagsMask;
289 } 287 }
290 288
291 protected virtual bool GenericObjectPermission(LLUUID currentUser, LLUUID objId) 289 protected virtual bool GenericObjectPermission(LLUUID currentUser, LLUUID objId)
292 { 290 {
293 // Default: deny 291 // Default: deny
@@ -307,10 +305,10 @@ namespace OpenSim.Region.Environment
307 305
308 306
309 SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objId]; 307 SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objId];
310 308
311 LLUUID objectOwner = group.OwnerID; 309 LLUUID objectOwner = group.OwnerID;
312 locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0); 310 locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0);
313 311
314 // People shouldn't be able to do anything with locked objects, except the Administrator 312 // People shouldn't be able to do anything with locked objects, except the Administrator
315 // The 'set permissions' runs through a different permission check, so when an object owner 313 // The 'set permissions' runs through a different permission check, so when an object owner
316 // sets an object locked, the only thing that they can do is unlock it. 314 // sets an object locked, the only thing that they can do is unlock it.
@@ -331,7 +329,7 @@ namespace OpenSim.Region.Environment
331 329
332 // Users should be able to edit what is over their land. 330 // Users should be able to edit what is over their land.
333 Land parcel = m_scene.LandManager.getLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y); 331 Land parcel = m_scene.LandManager.getLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y);
334 if ((parcel != null) && ( parcel.landData.ownerID == currentUser)) 332 if ((parcel != null) && (parcel.landData.ownerID == currentUser))
335 { 333 {
336 permission = true; 334 permission = true;
337 } 335 }
@@ -386,7 +384,7 @@ namespace OpenSim.Region.Environment
386 // The client 384 // The client
387 // may request to edit linked parts, and therefore, it needs 385 // may request to edit linked parts, and therefore, it needs
388 // to also check for SceneObjectPart 386 // to also check for SceneObjectPart
389 387
390 // If it's not an object, we cant edit it. 388 // If it's not an object, we cant edit it.
391 if ((!(m_scene.Entities[obj] is SceneObjectGroup))) 389 if ((!(m_scene.Entities[obj] is SceneObjectGroup)))
392 { 390 {
@@ -395,13 +393,13 @@ namespace OpenSim.Region.Environment
395 393
396 394
397 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[obj]; 395 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[obj];
398 396
399 397
400 LLUUID taskOwner = null; 398 LLUUID taskOwner = null;
401 // Added this because at this point in time it wouldn't be wise for 399 // Added this because at this point in time it wouldn't be wise for
402 // the administrator object permissions to take effect. 400 // the administrator object permissions to take effect.
403 LLUUID objectOwner = task.OwnerID; 401 LLUUID objectOwner = task.OwnerID;
404 402
405 // Anyone can move 403 // Anyone can move
406 if ((task.RootPart.EveryoneMask & PERM_MOVE) != 0) 404 if ((task.RootPart.EveryoneMask & PERM_MOVE) != 0)
407 permission = true; 405 permission = true;
@@ -430,7 +428,7 @@ namespace OpenSim.Region.Environment
430 return false; 428 return false;
431 } 429 }
432 430
433 SceneObjectGroup task = (SceneObjectGroup) m_scene.Entities[obj]; 431 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[obj];
434 LLUUID taskOwner = null; 432 LLUUID taskOwner = null;
435 // Added this because at this point in time it wouldn't be wise for 433 // Added this because at this point in time it wouldn't be wise for
436 // the administrator object permissions to take effect. 434 // the administrator object permissions to take effect.