aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2008-02-10 10:55:57 +0000
committerTeravus Ovares2008-02-10 10:55:57 +0000
commit85a9834ed84f33d3610499914fa3168a8eebce6d (patch)
tree23b51c0c9e944a64a54428d6f684210e784f42a3 /OpenSim/Region
parentClean up logging calls using String.Format explicitly (diff)
downloadopensim-SC_OLD-85a9834ed84f33d3610499914fa3168a8eebce6d.zip
opensim-SC_OLD-85a9834ed84f33d3610499914fa3168a8eebce6d.tar.gz
opensim-SC_OLD-85a9834ed84f33d3610499914fa3168a8eebce6d.tar.bz2
opensim-SC_OLD-85a9834ed84f33d3610499914fa3168a8eebce6d.tar.xz
* A lot of ugly permissions updates.
** Created SendFullUpdateToAllClientsExcept(LLUUID) so that permission updates /appear/ to apply immediately ** Separated out the ObjectFlags and the Permission Flags. They're related but not the same ** Added a hack routine to add *back* the objectflags to the client flags because the client hates the way we're doing object permissions ** Updated the clientflags routine to properly tell the client when they can't edit admin objects (objects owned by the sim administrator) even when they're an estate manager(why? >.< argh!) ** Fixed a null sim administrator/estate manager/user from causing permissions to return false even when it should return true. ** Re-added ObjectModify hack to allow collaboration with the allow anyone to move checkbox until we get group permissions done.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Environment/PermissionManager.cs164
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs9
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs60
3 files changed, 182 insertions, 51 deletions
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs
index 7cf89b0..5cd2b81 100644
--- a/OpenSim/Region/Environment/PermissionManager.cs
+++ b/OpenSim/Region/Environment/PermissionManager.cs
@@ -80,7 +80,13 @@ namespace OpenSim.Region.Environment
80 return true; 80 return true;
81 } 81 }
82 82
83 return m_scene.RegionInfo.MasterAvatarAssignedUUID == user; 83 // If there is no master avatar, return false
84 if (m_scene.RegionInfo.MasterAvatarAssignedUUID != null)
85 {
86 return m_scene.RegionInfo.MasterAvatarAssignedUUID == user;
87 }
88
89 return false;
84 } 90 }
85 91
86 public virtual bool IsEstateManager(LLUUID user) 92 public virtual bool IsEstateManager(LLUUID user)
@@ -89,13 +95,20 @@ namespace OpenSim.Region.Environment
89 { 95 {
90 return true; 96 return true;
91 } 97 }
92 98 if (user != null)
93 LLUUID[] estatemanagers = m_scene.RegionInfo.EstateSettings.estateManagers;
94 for (int i = 0; i < estatemanagers.Length; i++)
95 { 99 {
96 if (estatemanagers[i] == user) 100 LLUUID[] estatemanagers = m_scene.RegionInfo.EstateSettings.estateManagers;
97 return true; 101 for (int i = 0; i < estatemanagers.Length; i++)
102 {
103 if (estatemanagers[i] == user)
104 return true;
105 }
98 } 106 }
107 // The below is commented out because logically it happens anyway. It's left in for readability
108 //else
109 //{
110 //return false;
111 //}
99 112
100 return false; 113 return false;
101 } 114 }
@@ -153,6 +166,18 @@ namespace OpenSim.Region.Environment
153 166
154 public virtual uint GenerateClientFlags(LLUUID user, LLUUID objID) 167 public virtual uint GenerateClientFlags(LLUUID user, LLUUID objID)
155 { 168 {
169
170 // Here's the way this works,
171 // ObjectFlags and Permission flags are two different enumerations
172 // ObjectFlags, however, tells the client to change what it will allow the user to do.
173 // So, that means that all of the permissions type ObjectFlags are /temporary/ and only
174 // supposed to be set when customizing the objectflags for the client.
175
176 // These temporary objectflags get computed and added in this function based on the
177 // Permission mask that's appropriate!
178 // Outside of this method, they should never be added to objectflags!
179 // -teravus
180
156 if (!m_scene.Entities.ContainsKey(objID)) 181 if (!m_scene.Entities.ContainsKey(objID))
157 { 182 {
158 return 0; 183 return 0;
@@ -170,10 +195,38 @@ namespace OpenSim.Region.Environment
170 // the administrator object permissions to take effect. 195 // the administrator object permissions to take effect.
171 LLUUID objectOwner = task.OwnerID; 196 LLUUID objectOwner = task.OwnerID;
172 197
173 uint objectOwnerMask = task.RootPart.ObjectFlags; 198 uint objflags = task.RootPart.ObjectFlags;
174 objectOwnerMask = ApplyObjectModifyMasks(task.RootPart.OwnerMask, objectOwnerMask); 199
200
201 // Remove any of the objectFlags that are temporary. These will get added back if appropriate
202 // in the next bit of code
203
204 objflags &= (uint)LLObject.ObjectFlags.ObjectCopy; // Tells client you can copy the object
205 objflags &= (uint)LLObject.ObjectFlags.ObjectModify; // tells client you can modify the object
206 objflags &= (uint)LLObject.ObjectFlags.ObjectMove; // tells client that you can move the object (only, no mod)
207 objflags &= (uint)LLObject.ObjectFlags.ObjectTransfer; // tells the client that you can /take/ the object if you don't own it
208 objflags &= (uint)LLObject.ObjectFlags.ObjectYouOwner; // Tells client that you're the owner of the object
209 objflags &= (uint)LLObject.ObjectFlags.ObjectYouOfficer; // Tells client that you've got group object editing permission. Used when ObjectGroupOwned is set
210
211
212 // Creating the three ObjectFlags options for this method to choose from.
213 bool tasklocked = task.GetLocked(); // more debug needed to apply this, so we're going to set this to false for now
214 tasklocked = false;
175 215
176 uint objectEveryoneMask = task.RootPart.ObjectFlags | task.RootPart.EveryoneMask; 216 uint objectOwnerMask = ApplyObjectModifyMasks(task.RootPart.OwnerMask, objflags, tasklocked);
217 objectOwnerMask = AddBackBrokenObjectProperties(task.RootPart, objectOwnerMask);
218
219 objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectYouOwner;
220
221 uint objectGroupMask = ApplyObjectModifyMasks(task.RootPart.GroupMask, objflags, tasklocked);
222 objectGroupMask = AddBackBrokenObjectProperties(task.RootPart,objectGroupMask);
223
224 uint objectEveryoneMask = ApplyObjectModifyMasks(task.RootPart.EveryoneMask, objflags, tasklocked);
225 objectEveryoneMask = AddBackBrokenObjectProperties(task.RootPart,objectEveryoneMask);
226
227 // Hack to allow collaboration until Groups and Group Permissions are implemented
228 if ((objectEveryoneMask & (uint)LLObject.ObjectFlags.ObjectMove) != 0)
229 objectEveryoneMask |= (uint)LLObject.ObjectFlags.ObjectModify;
177 230
178 if (m_bypassPermissions) 231 if (m_bypassPermissions)
179 return objectOwnerMask; 232 return objectOwnerMask;
@@ -181,7 +234,6 @@ namespace OpenSim.Region.Environment
181 // Object owners should be able to edit their own content 234 // Object owners should be able to edit their own content
182 if (user == objectOwner) 235 if (user == objectOwner)
183 { 236 {
184 objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectYouOwner;
185 return objectOwnerMask; 237 return objectOwnerMask;
186 } 238 }
187 239
@@ -189,58 +241,70 @@ namespace OpenSim.Region.Environment
189 Land parcel = m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y); 241 Land parcel = m_scene.LandManager.getLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
190 if (parcel != null && parcel.landData.ownerID == user) 242 if (parcel != null && parcel.landData.ownerID == user)
191 return objectOwnerMask; 243 return objectOwnerMask;
192 244
245 // Admin objects should not be editable by the above
246 if (IsAdministrator(objectOwner))
247 return objectEveryoneMask;
248
193 // Estate users should be able to edit anything in the sim 249 // Estate users should be able to edit anything in the sim
194 if (IsEstateManager(user)) 250 if (IsEstateManager(user))
195 return objectOwnerMask; 251 return objectOwnerMask;
196 252
197 // Admin objects should not be editable by the above 253
198 if (IsAdministrator(taskOwner))
199 return objectEveryoneMask;
200 254
201 // Admin should be able to edit anything in the sim (including admin objects) 255 // Admin should be able to edit anything in the sim (including admin objects)
202 if (IsAdministrator(user)) 256 if (IsAdministrator(user))
203 return objectOwnerMask; 257 return objectOwnerMask;
204 258
205 if (((objectEveryoneMask & PERM_MOVE) != 0) || ((objectEveryoneMask & PERM_COPY) != 0))
206 {
207 if ((objectEveryoneMask & PERM_MOVE) != 0)
208 objectOwnerMask &= ~PERM_MOVE;
209 259
210 if ((objectEveryoneMask & PERM_COPY) != 0) 260 return objectEveryoneMask;
211 objectOwnerMask &= ~PERM_COPY; 261 }
262 private uint AddBackBrokenObjectProperties(SceneObjectPart task, uint objectmask)
263 {
264 if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0)
265 objectmask |= (uint)LLObject.ObjectFlags.Physics;
212 266
213 objectOwnerMask &= ~PERM_MODIFY; 267 if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.Scripted) != 0)
214 objectOwnerMask &= ~PERM_TRANS; 268 objectmask |= (uint)LLObject.ObjectFlags.Scripted;
215 269
216 return objectOwnerMask; 270 if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.TemporaryOnRez) != 0)
217 } 271 objectmask |= (uint)LLObject.ObjectFlags.TemporaryOnRez;
218 return objectEveryoneMask; 272
273 if ((task.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) != 0)
274 objectmask |= (uint)LLObject.ObjectFlags.Phantom;
275
276 return objectmask;
219 } 277 }
220 278
221 279
222 private uint ApplyObjectModifyMasks(uint parentMask, uint objectOwnerMask) 280 private uint ApplyObjectModifyMasks(uint setPermissionMask, uint objectFlagsMask, bool locked)
223 { 281 {
224 if ((parentMask & (uint)PermissionMask.Copy) != 0) 282 // We are adding the temporary objectflags to the object's objectflags based on the
283 // permission flag given. These change the F flags on the client.
284 if (!locked)
225 { 285 {
226 objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectCopy;
227 }
228 286
229 if ((parentMask & (uint)PermissionMask.Move) != 0) 287 if ((setPermissionMask & (uint)PermissionMask.Copy) != 0)
230 { 288 {
231 objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectMove; 289 objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectCopy;
232 } 290 }
233 291
234 if ((parentMask & (uint)PermissionMask.Modify) != 0) 292 if ((setPermissionMask & (uint)PermissionMask.Move) != 0)
235 { 293 {
236 objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectModify; 294 objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectMove;
237 } 295 }
238 296
239 if ((parentMask & (uint)PermissionMask.Transfer) != 0) 297 if ((setPermissionMask & (uint)PermissionMask.Modify) != 0)
240 { 298 {
241 objectOwnerMask |= (uint)LLObject.ObjectFlags.ObjectTransfer; 299 objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectModify;
300 }
301
302 if ((setPermissionMask & (uint)PermissionMask.Transfer) != 0)
303 {
304 objectFlagsMask |= (uint)LLObject.ObjectFlags.ObjectTransfer;
305 }
242 } 306 }
243 return objectOwnerMask; 307 return objectFlagsMask;
244 } 308 }
245 309
246 protected virtual bool GenericObjectPermission(LLUUID currentUser, LLUUID objId) 310 protected virtual bool GenericObjectPermission(LLUUID currentUser, LLUUID objId)
@@ -254,13 +318,14 @@ namespace OpenSim.Region.Environment
254 } 318 }
255 319
256 // If it's not an object, we cant edit it. 320 // If it's not an object, we cant edit it.
257 if (!(m_scene.Entities[objId] is SceneObjectGroup)) 321 if ((!(m_scene.Entities[objId] is SceneObjectGroup)))
258 { 322 {
259 return false; 323 return false;
260 } 324 }
261 325
262 SceneObjectGroup group = (SceneObjectGroup) m_scene.Entities[objId]; 326
263 327 SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objId];
328
264 LLUUID objectOwner = group.OwnerID; 329 LLUUID objectOwner = group.OwnerID;
265 330
266 // Object owners should be able to edit their own content 331 // Object owners should be able to edit their own content
@@ -323,13 +388,20 @@ namespace OpenSim.Region.Environment
323 return false; 388 return false;
324 } 389 }
325 390
391 // The client
392 // may request to edit linked parts, and therefore, it needs
393 // to also check for SceneObjectPart
394
326 // If it's not an object, we cant edit it. 395 // If it's not an object, we cant edit it.
327 if (!(m_scene.Entities[obj] is SceneObjectGroup)) 396 if ((!(m_scene.Entities[obj] is SceneObjectGroup)))
328 { 397 {
329 return false; 398 return false;
330 } 399 }
331 400
332 SceneObjectGroup task = (SceneObjectGroup) m_scene.Entities[obj]; 401
402 SceneObjectGroup task = (SceneObjectGroup)m_scene.Entities[obj];
403
404
333 LLUUID taskOwner = null; 405 LLUUID taskOwner = null;
334 // Added this because at this point in time it wouldn't be wise for 406 // Added this because at this point in time it wouldn't be wise for
335 // the administrator object permissions to take effect. 407 // the administrator object permissions to take effect.
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index c204389..a14d869 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -60,6 +60,7 @@ namespace OpenSim.Region.Environment.Scenes
60 /// since the group's last persistent backup 60 /// since the group's last persistent backup
61 /// </summary> 61 /// </summary>
62 public bool HasGroupChanged = false; 62 public bool HasGroupChanged = false;
63 private bool m_locked = false;
63 64
64 private LLVector3 lastPhysGroupPos; 65 private LLVector3 lastPhysGroupPos;
65 private LLQuaternion lastPhysGroupRot; 66 private LLQuaternion lastPhysGroupRot;
@@ -1217,7 +1218,15 @@ namespace OpenSim.Region.Environment.Scenes
1217 part.UpdateExtraParam(type, inUse, data); 1218 part.UpdateExtraParam(type, inUse, data);
1218 } 1219 }
1219 } 1220 }
1221 public bool GetLocked()
1222 {
1223 return m_locked;
1224 }
1225 public void SetLocked(bool val)
1226 {
1227 m_locked = val;
1220 1228
1229 }
1221 /// <summary> 1230 /// <summary>
1222 /// 1231 ///
1223 /// </summary> 1232 /// </summary>
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 0a9d21a..8c25dfa 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -44,7 +44,19 @@ namespace OpenSim.Region.Environment.Scenes
44{ 44{
45 // I don't really know where to put this except here. 45 // I don't really know where to put this except here.
46 // Can't access the OpenSim.Region.ScriptEngine.Common.LSL_BaseClass.Changed constants 46 // Can't access the OpenSim.Region.ScriptEngine.Common.LSL_BaseClass.Changed constants
47 47 [Flags]
48 public enum ExtraParamType
49 {
50 Something1 = 1,
51 Something2 = 2,
52 Something3 = 4,
53 Something4 = 8,
54 Flexible = 16,
55 Light = 32,
56 Sculpt = 48,
57 Something5 = 64,
58 Something6 = 128
59 }
48 [Flags] 60 [Flags]
49 public enum Changed : uint 61 public enum Changed : uint
50 { 62 {
@@ -1166,6 +1178,15 @@ namespace OpenSim.Region.Environment.Scenes
1166 1178
1167 public void UpdatePrimFlags(ushort type, bool inUse, byte[] data) 1179 public void UpdatePrimFlags(ushort type, bool inUse, byte[] data)
1168 { 1180 {
1181
1182
1183 //m_log.Info("TSomething1:" + ((type & (ushort)ExtraParamType.Something1) == (ushort)ExtraParamType.Something1));
1184 //m_log.Info("TSomething2:" + ((type & (ushort)ExtraParamType.Something2) == (ushort)ExtraParamType.Something2));
1185 //m_log.Info("TSomething3:" + ((type & (ushort)ExtraParamType.Something3) == (ushort)ExtraParamType.Something3));
1186 //m_log.Info("TSomething4:" + ((type & (ushort)ExtraParamType.Something4) == (ushort)ExtraParamType.Something4));
1187 //m_log.Info("TSomething5:" + ((type & (ushort)ExtraParamType.Something5) == (ushort)ExtraParamType.Something5));
1188 //m_log.Info("TSomething6:" + ((type & (ushort)ExtraParamType.Something6) == (ushort)ExtraParamType.Something6));
1189
1169 bool usePhysics = false; 1190 bool usePhysics = false;
1170 bool IsTemporary = false; 1191 bool IsTemporary = false;
1171 bool IsPhantom = false; 1192 bool IsPhantom = false;
@@ -1173,7 +1194,7 @@ namespace OpenSim.Region.Environment.Scenes
1173 bool wasUsingPhysics = ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0); 1194 bool wasUsingPhysics = ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0);
1174 //bool IsLocked = false; 1195 //bool IsLocked = false;
1175 int i = 0; 1196 int i = 0;
1176 1197
1177 1198
1178 try 1199 try
1179 { 1200 {
@@ -1579,7 +1600,7 @@ namespace OpenSim.Region.Environment.Scenes
1579 //EveryoneMask |= (uint)57344; 1600 //EveryoneMask |= (uint)57344;
1580 } 1601 }
1581 //ScheduleFullUpdate(); 1602 //ScheduleFullUpdate();
1582 SendFullUpdateToAllClients(); 1603 SendFullUpdateToAllClientsExcept(AgentID);
1583 } 1604 }
1584 //Field 16 = NextownerMask 1605 //Field 16 = NextownerMask
1585 if (field == (byte) 16) 1606 if (field == (byte) 16)
@@ -1592,11 +1613,28 @@ namespace OpenSim.Region.Environment.Scenes
1592 { 1613 {
1593 NextOwnerMask |= mask; 1614 NextOwnerMask |= mask;
1594 } 1615 }
1616 SendFullUpdateToAllClientsExcept(AgentID);
1617 }
1618
1619 if (field == (byte)2)
1620 {
1621 if (addRemTF == (byte)0)
1622 {
1623 m_parentGroup.SetLocked(true);
1624 //OwnerMask &= ~mask;
1625 }
1626 else
1627 {
1628 m_parentGroup.SetLocked(false);
1629 //OwnerMask |= mask;
1630 }
1595 SendFullUpdateToAllClients(); 1631 SendFullUpdateToAllClients();
1632
1596 } 1633 }
1634
1597 } 1635 }
1598 } 1636 }
1599 1637
1600 #region Client Update Methods 1638 #region Client Update Methods
1601 1639
1602 public void AddFullUpdateToAllAvatars() 1640 public void AddFullUpdateToAllAvatars()
@@ -1607,7 +1645,19 @@ namespace OpenSim.Region.Environment.Scenes
1607 avatars[i].QueuePartForUpdate(this); 1645 avatars[i].QueuePartForUpdate(this);
1608 } 1646 }
1609 } 1647 }
1610 1648 public void SendFullUpdateToAllClientsExcept(LLUUID agentID)
1649 {
1650 List<ScenePresence> avatars = m_parentGroup.GetScenePresences();
1651 for (int i = 0; i < avatars.Count; i++)
1652 {
1653 // Ugly reference :(
1654 if (avatars[i].UUID != agentID)
1655 {
1656 m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this,
1657 avatars[i].GenerateClientFlags(UUID));
1658 }
1659 }
1660 }
1611 public void AddFullUpdateToAvatar(ScenePresence presence) 1661 public void AddFullUpdateToAvatar(ScenePresence presence)
1612 { 1662 {
1613 presence.QueuePartForUpdate(this); 1663 presence.QueuePartForUpdate(this);