aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorlbsa712008-02-11 13:26:55 +0000
committerlbsa712008-02-11 13:26:55 +0000
commitc927928245fcd2c0b028029587d91b34ff145d91 (patch)
tree7aaa930f611e29d26e89f03408cc1a9151e703cd /OpenSim
parentFrom: Ansgar Schmidt <ANSI@de.ibm.com> (diff)
downloadopensim-SC_OLD-c927928245fcd2c0b028029587d91b34ff145d91.zip
opensim-SC_OLD-c927928245fcd2c0b028029587d91b34ff145d91.tar.gz
opensim-SC_OLD-c927928245fcd2c0b028029587d91b34ff145d91.tar.bz2
opensim-SC_OLD-c927928245fcd2c0b028029587d91b34ff145d91.tar.xz
* some refactoring on permissions
* temporary re-introduced the weird 'flip-back' behaviour, but debugging it; will remove it if I don't find anything.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Environment/PermissionManager.cs104
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs6
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs78
5 files changed, 84 insertions, 108 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.
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index fee1e66..16f15a2 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -199,7 +199,7 @@ namespace OpenSim.Region.Environment.Scenes
199 // Update item with new asset 199 // Update item with new asset
200 item.AssetID = asset.FullID; 200 item.AssetID = asset.FullID;
201 group.UpdateInventoryItem(item); 201 group.UpdateInventoryItem(item);
202 group.GetProperites(remoteClient); 202 group.GetProperties(remoteClient);
203 203
204 // Trigger rerunning of script (use TriggerRezScript event, see RezScript) 204 // Trigger rerunning of script (use TriggerRezScript event, see RezScript)
205 if (isScriptRunning) 205 if (isScriptRunning)
@@ -520,7 +520,7 @@ namespace OpenSim.Region.Environment.Scenes
520 if (group != null) 520 if (group != null)
521 { 521 {
522 int type = group.RemoveInventoryItem(localID, itemID); 522 int type = group.RemoveInventoryItem(localID, itemID);
523 group.GetProperites(remoteClient); 523 group.GetProperties(remoteClient);
524 if (type == 10) 524 if (type == 10)
525 { 525 {
526 EventManager.TriggerRemoveScript(localID, itemID); 526 EventManager.TriggerRemoveScript(localID, itemID);
@@ -599,7 +599,7 @@ namespace OpenSim.Region.Environment.Scenes
599 { 599 {
600 group.AddInventoryItem(remoteClient, localID, item, copyID); 600 group.AddInventoryItem(remoteClient, localID, item, copyID);
601 group.StartScript(localID, copyID); 601 group.StartScript(localID, copyID);
602 group.GetProperites(remoteClient); 602 group.GetProperties(remoteClient);
603 603
604 // m_log.Info( 604 // m_log.Info(
605 // String.Format("[PRIMINVENTORY]: " + 605 // String.Format("[PRIMINVENTORY]: " +
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 86f10d7..5071f9b 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -106,7 +106,7 @@ namespace OpenSim.Region.Environment.Scenes
106 { 106 {
107 if (((SceneObjectGroup) ent).LocalId == primLocalID) 107 if (((SceneObjectGroup) ent).LocalId == primLocalID)
108 { 108 {
109 ((SceneObjectGroup) ent).GetProperites(remoteClient); 109 ((SceneObjectGroup) ent).GetProperties(remoteClient);
110 ((SceneObjectGroup) ent).IsSelected = true; 110 ((SceneObjectGroup) ent).IsSelected = true;
111 LandManager.setPrimsTainted(); 111 LandManager.setPrimsTainted();
112 break; 112 break;
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 83f0c27..78e7868 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1078,7 +1078,7 @@ namespace OpenSim.Region.Environment.Scenes
1078 /// 1078 ///
1079 /// </summary> 1079 /// </summary>
1080 /// <param name="client"></param> 1080 /// <param name="client"></param>
1081 public void GetProperites(IClientAPI client) 1081 public void GetProperties(IClientAPI client)
1082 { 1082 {
1083 ObjectPropertiesPacket proper = (ObjectPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ObjectProperties); 1083 ObjectPropertiesPacket proper = (ObjectPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ObjectProperties);
1084 // TODO: don't create new blocks if recycling an old packet 1084 // TODO: don't create new blocks if recycling an old packet
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 06c0472..180ed51 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -1577,65 +1577,43 @@ namespace OpenSim.Region.Environment.Scenes
1577 1577
1578 public void UpdatePermissions(LLUUID AgentID, byte field, uint localID, uint mask, byte addRemTF) 1578 public void UpdatePermissions(LLUUID AgentID, byte field, uint localID, uint mask, byte addRemTF)
1579 { 1579 {
1580 bool set = addRemTF == 1;
1581
1580 // Are we the owner? 1582 // Are we the owner?
1581 if (AgentID == OwnerID) 1583 if (AgentID == OwnerID)
1582 { 1584 {
1583 m_log.Info("[PERMISSIONS]: field: " + field.ToString() + ", mask: " + mask.ToString() + " addRemTF: " + 1585 switch (field)
1584 addRemTF.ToString());
1585
1586 //Field 8 = EveryoneMask
1587 if (field == (byte) 8)
1588 {
1589 m_log.Info("[PERMISSIONS]: Left over: " + (OwnerMask - EveryoneMask));
1590 if (addRemTF == (byte) 0)
1591 {
1592 //EveryoneMask = (uint)0;
1593 EveryoneMask &= ~mask;
1594 //EveryoneMask &= ~(uint)57344;
1595 }
1596 else
1597 {
1598 //EveryoneMask = (uint)0;
1599 EveryoneMask |= mask;
1600 //EveryoneMask |= (uint)57344;
1601 }
1602 //ScheduleFullUpdate();
1603 SendFullUpdateToAllClientsExcept(AgentID);
1604 }
1605 //Field 16 = NextownerMask
1606 if (field == (byte) 16)
1607 { 1586 {
1608 if (addRemTF == (byte) 0) 1587 case 2:
1609 { 1588 OwnerMask = ApplyMask(OwnerMask, set, mask);
1610 NextOwnerMask &= ~mask; 1589 break;
1611 } 1590 case 4:
1612 else 1591 GroupMask = ApplyMask(GroupMask, set, mask);
1613 { 1592 break;
1614 NextOwnerMask |= mask; 1593 case 8:
1615 } 1594 EveryoneMask = ApplyMask(EveryoneMask, set, mask);
1616 SendFullUpdateToAllClientsExcept(AgentID); 1595 break;
1596 case 16:
1597 NextOwnerMask = ApplyMask(NextOwnerMask, set, mask);
1598 break;
1617 } 1599 }
1618 1600
1619 if (field == (byte)2) 1601 ScheduleFullUpdate();
1620 { 1602 }
1621 if (addRemTF == (byte)0) 1603 }
1622 {
1623 //m_parentGroup.SetLocked(true);
1624 //PermissionMask.
1625 OwnerMask &= ~mask;
1626 }
1627 else
1628 {
1629 //m_parentGroup.SetLocked(false);
1630 OwnerMask |= mask;
1631 }
1632 SendFullUpdateToAllClients();
1633
1634 }
1635 1604
1605 private uint ApplyMask(uint val, bool set, uint mask)
1606 {
1607 if (set)
1608 {
1609 return val |= mask;
1610 }
1611 else
1612 {
1613 return val &= ~mask;
1636 } 1614 }
1637 } 1615 }
1638 1616
1639 #region Client Update Methods 1617 #region Client Update Methods
1640 1618
1641 public void AddFullUpdateToAllAvatars() 1619 public void AddFullUpdateToAllAvatars()