aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2010-12-13 20:35:56 +0000
committerMelanie2010-12-13 20:35:56 +0000
commit9bd7f3b03a315d713d53451a36fd64c419ce5f35 (patch)
tree2c56939c277504a6b9997b825255a70df6b37cf2
parentChange some lookups in he Land Management module to make group permissions (diff)
downloadopensim-SC_OLD-9bd7f3b03a315d713d53451a36fd64c419ce5f35.zip
opensim-SC_OLD-9bd7f3b03a315d713d53451a36fd64c419ce5f35.tar.gz
opensim-SC_OLD-9bd7f3b03a315d713d53451a36fd64c419ce5f35.tar.bz2
opensim-SC_OLD-9bd7f3b03a315d713d53451a36fd64c419ce5f35.tar.xz
Revamp the viewer -> banlist packet processing so fix a number of bugs.
Remove the too coarse CanEditParcel method in favor of a CanEditParcelProperties method that takes a GroupPowers argument to specify what action is to be taken. Also, make the method to set parcel data much more granular. Permissions in a deeded setting should now work.
-rw-r--r--OpenSim/Framework/IClientAPI.cs7
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs10
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs34
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs200
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs56
-rw-r--r--OpenSim/Region/Framework/Interfaces/ILandObject.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs14
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs2
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs88
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs2
11 files changed, 241 insertions, 178 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 027f9c5..b9c9323 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -174,9 +174,10 @@ namespace OpenSim.Framework
174 public delegate void ParcelAccessListRequest( 174 public delegate void ParcelAccessListRequest(
175 UUID agentID, UUID sessionID, uint flags, int sequenceID, int landLocalID, IClientAPI remote_client); 175 UUID agentID, UUID sessionID, uint flags, int sequenceID, int landLocalID, IClientAPI remote_client);
176 176
177 public delegate void ParcelAccessListUpdateRequest( 177 public delegate void ParcelAccessListUpdateRequest(UUID agentID, uint flags,
178 UUID agentID, UUID sessionID, uint flags, int landLocalID, List<ParcelManager.ParcelAccessEntry> entries, 178 int landLocalID, UUID transactionID, int sequenceID,
179 IClientAPI remote_client); 179 int sections, List<ParcelManager.ParcelAccessEntry> entries,
180 IClientAPI remote_client);
180 181
181 public delegate void ParcelPropertiesRequest( 182 public delegate void ParcelPropertiesRequest(
182 int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client); 183 int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client);
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index f125822..c934b9e 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -8239,7 +8239,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8239 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 8239 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
8240 entry.AgentID = block.ID; 8240 entry.AgentID = block.ID;
8241 entry.Flags = (AccessList)block.Flags; 8241 entry.Flags = (AccessList)block.Flags;
8242 entry.Time = new DateTime(); 8242 entry.Time = Util.ToDateTime(block.Time);
8243 entries.Add(entry); 8243 entries.Add(entry);
8244 } 8244 }
8245 8245
@@ -8247,8 +8247,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8247 if (handlerParcelAccessListUpdateRequest != null) 8247 if (handlerParcelAccessListUpdateRequest != null)
8248 { 8248 {
8249 handlerParcelAccessListUpdateRequest(updatePacket.AgentData.AgentID, 8249 handlerParcelAccessListUpdateRequest(updatePacket.AgentData.AgentID,
8250 updatePacket.AgentData.SessionID, updatePacket.Data.Flags, 8250 updatePacket.Data.Flags,
8251 updatePacket.Data.LocalID, entries, this); 8251 updatePacket.Data.LocalID,
8252 updatePacket.Data.TransactionID,
8253 updatePacket.Data.SequenceID,
8254 updatePacket.Data.Sections,
8255 entries, this);
8252 } 8256 }
8253 return true; 8257 return true;
8254 } 8258 }
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 695202f..ac4705c 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.World.Land
159 client.OnParcelSelectObjects += ClientOnParcelSelectObjects; 159 client.OnParcelSelectObjects += ClientOnParcelSelectObjects;
160 client.OnParcelObjectOwnerRequest += ClientOnParcelObjectOwnerRequest; 160 client.OnParcelObjectOwnerRequest += ClientOnParcelObjectOwnerRequest;
161 client.OnParcelAccessListRequest += ClientOnParcelAccessListRequest; 161 client.OnParcelAccessListRequest += ClientOnParcelAccessListRequest;
162 client.OnParcelAccessListUpdateRequest += ClientOnParcelAccessUpdateListRequest; 162 client.OnParcelAccessListUpdateRequest += ClientOnParcelAccessListUpdateRequest;
163 client.OnParcelAbandonRequest += ClientOnParcelAbandonRequest; 163 client.OnParcelAbandonRequest += ClientOnParcelAbandonRequest;
164 client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner; 164 client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner;
165 client.OnParcelReclaim += ClientOnParcelReclaim; 165 client.OnParcelReclaim += ClientOnParcelReclaim;
@@ -508,14 +508,22 @@ namespace OpenSim.Region.CoreModules.World.Land
508 508
509 if (land != null) 509 if (land != null)
510 { 510 {
511 m_landList[landLocalID].SendAccessList(agentID, sessionID, flags, sequenceID, remote_client); 511 land.SendAccessList(agentID, sessionID, flags, sequenceID, remote_client);
512 } 512 }
513 } 513 }
514 514
515 public void ClientOnParcelAccessUpdateListRequest(UUID agentID, UUID sessionID, uint flags, int landLocalID, 515 public void ClientOnParcelAccessListUpdateRequest(UUID agentID,
516 List<ParcelManager.ParcelAccessEntry> entries, 516 uint flags, int landLocalID, UUID transactionID, int sequenceID,
517 IClientAPI remote_client) 517 int sections, List<ParcelManager.ParcelAccessEntry> entries,
518 IClientAPI remote_client)
518 { 519 {
520 // Flags is the list to update, it can mean either the ban or
521 // the access list (WTH is a pass list? Mentioned in ParcelFlags)
522 //
523 // There may be multiple packets, because these can get LONG.
524 // Use transactionID to determine a new chain of packets since
525 // packets may have come in out of sequence and that would be
526 // a big mess if using the sequenceID
519 ILandObject land; 527 ILandObject land;
520 lock (m_landList) 528 lock (m_landList)
521 { 529 {
@@ -524,9 +532,15 @@ namespace OpenSim.Region.CoreModules.World.Land
524 532
525 if (land != null) 533 if (land != null)
526 { 534 {
527 if (agentID == land.LandData.OwnerID) 535 GroupPowers requiredPowers = GroupPowers.LandManageAllowed;
536 if (flags == (uint)AccessList.Ban)
537 requiredPowers = GroupPowers.LandManageBanned;
538
539 if (m_scene.Permissions.CanEditParcelProperties(agentID,
540 land, requiredPowers))
528 { 541 {
529 land.UpdateAccessList(flags, entries, remote_client); 542 land.UpdateAccessList(flags, transactionID, sequenceID,
543 sections, entries, remote_client);
530 } 544 }
531 } 545 }
532 else 546 else
@@ -854,7 +868,7 @@ namespace OpenSim.Region.CoreModules.World.Land
854 868
855 //If we are still here, then they are subdividing within one piece of land 869 //If we are still here, then they are subdividing within one piece of land
856 //Check owner 870 //Check owner
857 if (!m_scene.Permissions.CanEditParcel(attempting_user_id, startLandObject)) 871 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, startLandObject, GroupPowers.LandDivideJoin))
858 { 872 {
859 return; 873 return;
860 } 874 }
@@ -922,7 +936,7 @@ namespace OpenSim.Region.CoreModules.World.Land
922 { 936 {
923 return; 937 return;
924 } 938 }
925 if (!m_scene.Permissions.CanEditParcel(attempting_user_id, masterLandObject)) 939 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, masterLandObject, GroupPowers.LandDivideJoin))
926 { 940 {
927 return; 941 return;
928 } 942 }
@@ -1570,7 +1584,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1570 1584
1571 if (land == null) return; 1585 if (land == null) return;
1572 1586
1573 if (!m_scene.Permissions.CanEditParcel(remoteClient.AgentId, land)) 1587 if (!m_scene.Permissions.CanEditParcelProperties(remoteClient.AgentId, land, GroupPowers.LandOptions))
1574 return; 1588 return;
1575 1589
1576 land.LandData.OtherCleanTime = otherCleanTime; 1590 land.LandData.OtherCleanTime = otherCleanTime;
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index d87352f..801d3a4 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -54,6 +54,7 @@ namespace OpenSim.Region.CoreModules.World.Land
54 protected LandData m_landData = new LandData(); 54 protected LandData m_landData = new LandData();
55 protected Scene m_scene; 55 protected Scene m_scene;
56 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); 56 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
57 protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>();
57 58
58 public bool[,] LandBitmap 59 public bool[,] LandBitmap
59 { 60 {
@@ -199,36 +200,81 @@ namespace OpenSim.Region.CoreModules.World.Land
199 200
200 public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) 201 public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client)
201 { 202 {
202 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId,this)) 203 //Needs later group support
204 bool snap_selection = false;
205 LandData newData = LandData.Copy();
206
207 uint allowedDelta = 0;
208
209 // These two are always blocked as no client can set them anyway
210 // ParcelFlags.ForSaleObjects
211 // ParcelFlags.LindenHome
212
213 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions))
203 { 214 {
204 //Needs later group support 215 allowedDelta |= (uint)(ParcelFlags.AllowLandmark |
205 bool snap_selection = false; 216 ParcelFlags.AllowTerraform |
206 LandData newData = LandData.Copy(); 217 ParcelFlags.AllowDamage |
218 ParcelFlags.CreateObjects |
219 ParcelFlags.RestrictPushObject |
220 ParcelFlags.AllowGroupScripts |
221 ParcelFlags.CreateGroupObjects |
222 ParcelFlags.AllowAPrimitiveEntry |
223 ParcelFlags.AllowGroupObjectEntry);
224 }
207 225
208 if (args.AuthBuyerID != newData.AuthBuyerID || args.SalePrice != newData.SalePrice) 226 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandSetSale))
227 {
228 if (args.AuthBuyerID != newData.AuthBuyerID ||
229 args.SalePrice != newData.SalePrice)
209 { 230 {
210 if (m_scene.Permissions.CanSellParcel(remote_client.AgentId, this)) 231 snap_selection = true;
211 { 232 }
212 newData.AuthBuyerID = args.AuthBuyerID; 233
213 newData.SalePrice = args.SalePrice; 234 newData.AuthBuyerID = args.AuthBuyerID;
214 snap_selection = true; 235 newData.SalePrice = args.SalePrice;
215 } 236
237 if (!LandData.IsGroupOwned)
238 {
239 newData.GroupID = args.GroupID;
240
241 allowedDelta |= (uint)(ParcelFlags.AllowDeedToGroup |
242 ParcelFlags.ContributeWithDeed |
243 ParcelFlags.SellParcelObjects);
216 } 244 }
245
246 allowedDelta |= (uint)ParcelFlags.ForSale;
247 }
248
249 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.FindPlaces))
250 {
217 newData.Category = args.Category; 251 newData.Category = args.Category;
252
253 allowedDelta |= (uint)(ParcelFlags.ShowDirectory |
254 ParcelFlags.AllowPublish |
255 ParcelFlags.MaturePublish);
256 }
257
258 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity))
259 {
218 newData.Description = args.Desc; 260 newData.Description = args.Desc;
219 newData.GroupID = args.GroupID; 261 newData.Name = args.Name;
262 newData.SnapshotID = args.SnapshotID;
263 }
264
265 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.SetLandingPoint))
266 {
220 newData.LandingType = args.LandingType; 267 newData.LandingType = args.LandingType;
268 newData.UserLocation = args.UserLocation;
269 newData.UserLookAt = args.UserLookAt;
270 }
271
272 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.ChangeMedia))
273 {
221 newData.MediaAutoScale = args.MediaAutoScale; 274 newData.MediaAutoScale = args.MediaAutoScale;
222 newData.MediaID = args.MediaID; 275 newData.MediaID = args.MediaID;
223 newData.MediaURL = args.MediaURL; 276 newData.MediaURL = args.MediaURL;
224 newData.MusicURL = args.MusicURL; 277 newData.MusicURL = args.MusicURL;
225 newData.Name = args.Name;
226 newData.Flags = args.ParcelFlags;
227 newData.PassHours = args.PassHours;
228 newData.PassPrice = args.PassPrice;
229 newData.SnapshotID = args.SnapshotID;
230 newData.UserLocation = args.UserLocation;
231 newData.UserLookAt = args.UserLookAt;
232 newData.MediaType = args.MediaType; 278 newData.MediaType = args.MediaType;
233 newData.MediaDescription = args.MediaDescription; 279 newData.MediaDescription = args.MediaDescription;
234 newData.MediaWidth = args.MediaWidth; 280 newData.MediaWidth = args.MediaWidth;
@@ -237,10 +283,40 @@ namespace OpenSim.Region.CoreModules.World.Land
237 newData.ObscureMusic = args.ObscureMusic; 283 newData.ObscureMusic = args.ObscureMusic;
238 newData.ObscureMedia = args.ObscureMedia; 284 newData.ObscureMedia = args.ObscureMedia;
239 285
240 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 286 allowedDelta |= (uint)(ParcelFlags.SoundLocal |
287 ParcelFlags.UrlWebPage |
288 ParcelFlags.UrlRawHtml |
289 ParcelFlags.AllowVoiceChat |
290 ParcelFlags.UseEstateVoiceChan);
291 }
292
293 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandManagePasses))
294 {
295 newData.PassHours = args.PassHours;
296 newData.PassPrice = args.PassPrice;
297
298 allowedDelta |= (uint)ParcelFlags.UsePassList;
299 }
300
301 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageAllowed))
302 {
303 allowedDelta |= (uint)(ParcelFlags.UseAccessGroup |
304 ParcelFlags.UseAccessList);
305 }
241 306
242 SendLandUpdateToAvatarsOverMe(snap_selection); 307 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageBanned))
308 {
309 allowedDelta |= (uint)(ParcelFlags.UseBanList |
310 ParcelFlags.DenyAnonymous |
311 ParcelFlags.DenyAgeUnverified);
243 } 312 }
313
314 uint preserve = LandData.Flags & ~allowedDelta;
315 newData.Flags = preserve | (args.ParcelFlags & allowedDelta);
316
317 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
318
319 SendLandUpdateToAvatarsOverMe(snap_selection);
244 } 320 }
245 321
246 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) 322 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area)
@@ -295,14 +371,14 @@ namespace OpenSim.Region.CoreModules.World.Land
295 371
296 if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) 372 if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0)
297 { 373 {
298 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 374 if (LandData.ParcelAccessList.FindIndex(
299 entry.AgentID = avatar; 375 delegate(ParcelManager.ParcelAccessEntry e)
300 entry.Flags = AccessList.Ban; 376 {
301 entry.Time = new DateTime(); 377 if (e.AgentID == avatar && e.Flags == AccessList.Ban)
302 //See if they are on the list, but make sure the owner isn't banned 378 return true;
303 if (LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) 379 return false;
380 }) != -1 && LandData.OwnerID != avatar)
304 { 381 {
305 //They are banned, so lets send them a notice about this parcel
306 return true; 382 return true;
307 } 383 }
308 } 384 }
@@ -316,15 +392,14 @@ namespace OpenSim.Region.CoreModules.World.Land
316 392
317 if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) 393 if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0)
318 { 394 {
319 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 395 if (LandData.ParcelAccessList.FindIndex(
320 entry.AgentID = avatar; 396 delegate(ParcelManager.ParcelAccessEntry e)
321 entry.Flags = AccessList.Access; 397 {
322 entry.Time = new DateTime(); 398 if (e.AgentID == avatar && e.Flags == AccessList.Access)
323 399 return true;
324 //If they are not on the access list and are not the owner 400 return false;
325 if (!LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) 401 }) == -1 && LandData.OwnerID != avatar)
326 { 402 {
327 //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
328 return true; 403 return true;
329 } 404 }
330 } 405 }
@@ -421,39 +496,50 @@ namespace OpenSim.Region.CoreModules.World.Land
421 } 496 }
422 } 497 }
423 498
424 public void UpdateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client) 499 public void UpdateAccessList(uint flags, UUID transactionID,
500 int sequenceID, int sections,
501 List<ParcelManager.ParcelAccessEntry> entries,
502 IClientAPI remote_client)
425 { 503 {
426 LandData newData = LandData.Copy(); 504 LandData newData = LandData.Copy();
427 505
428 if (entries.Count == 1 && entries[0].AgentID == UUID.Zero) 506 if ((!m_listTransactions.ContainsKey(flags)) ||
507 m_listTransactions[flags] != transactionID)
429 { 508 {
430 entries.Clear(); 509 m_listTransactions[flags] = transactionID;
431 }
432 510
433 List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>(); 511 List<ParcelManager.ParcelAccessEntry> toRemove =
434 foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList) 512 new List<ParcelManager.ParcelAccessEntry>();
435 { 513
436 if (entry.Flags == (AccessList)flags) 514 foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList)
437 { 515 {
438 toRemove.Add(entry); 516 if (entry.Flags == (AccessList)flags)
517 toRemove.Add(entry);
439 } 518 }
440 }
441 519
442 foreach (ParcelManager.ParcelAccessEntry entry in toRemove) 520 foreach (ParcelManager.ParcelAccessEntry entry in toRemove)
443 { 521 {
444 newData.ParcelAccessList.Remove(entry); 522 newData.ParcelAccessList.Remove(entry);
523 }
524
525 // Checked here because this will always be the first
526 // and only packet in a transaction
527 if (entries.Count == 1 && entries[0].AgentID == UUID.Zero)
528 {
529 return;
530 }
445 } 531 }
532
446 foreach (ParcelManager.ParcelAccessEntry entry in entries) 533 foreach (ParcelManager.ParcelAccessEntry entry in entries)
447 { 534 {
448 ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry(); 535 ParcelManager.ParcelAccessEntry temp =
536 new ParcelManager.ParcelAccessEntry();
537
449 temp.AgentID = entry.AgentID; 538 temp.AgentID = entry.AgentID;
450 temp.Time = new DateTime(); //Pointless? Yes. 539 temp.Time = entry.Time;
451 temp.Flags = (AccessList)flags; 540 temp.Flags = (AccessList)flags;
452 541
453 if (!newData.ParcelAccessList.Contains(temp)) 542 newData.ParcelAccessList.Add(temp);
454 {
455 newData.ParcelAccessList.Add(temp);
456 }
457 } 543 }
458 544
459 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 545 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
@@ -711,7 +797,7 @@ namespace OpenSim.Region.CoreModules.World.Land
711 797
712 public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client) 798 public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client)
713 { 799 {
714 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) 800 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions))
715 { 801 {
716 List<uint> resultLocalIDs = new List<uint>(); 802 List<uint> resultLocalIDs = new List<uint>();
717 try 803 try
@@ -761,7 +847,7 @@ namespace OpenSim.Region.CoreModules.World.Land
761 /// </param> 847 /// </param>
762 public void SendLandObjectOwners(IClientAPI remote_client) 848 public void SendLandObjectOwners(IClientAPI remote_client)
763 { 849 {
764 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) 850 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions))
765 { 851 {
766 Dictionary<UUID, int> primCount = new Dictionary<UUID, int>(); 852 Dictionary<UUID, int> primCount = new Dictionary<UUID, int>();
767 List<UUID> groups = new List<UUID>(); 853 List<UUID> groups = new List<UUID>();
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index f5f3839..364dd6c 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -37,56 +37,6 @@ using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
39 39
40// Temporary fix of wrong GroupPowers constants in OpenMetaverse library
41enum GroupPowers : long
42 {
43 None = 0,
44 LandEjectAndFreeze = 1,
45 Invite = 2,
46 ReturnGroupSet = 2,
47 Eject = 4,
48 ReturnNonGroup = 4,
49 ChangeOptions = 8,
50 LandGardening = 8,
51 CreateRole = 16,
52 DeedObject = 16,
53 ModerateChat = 32,
54 DeleteRole = 32,
55 RoleProperties = 64,
56 ObjectManipulate = 64,
57 ObjectSetForSale = 128,
58 AssignMemberLimited = 128,
59 AssignMember = 256,
60 Accountable = 256,
61 RemoveMember = 512,
62 SendNotices = 1024,
63 ChangeActions = 1024,
64 ChangeIdentity = 2048,
65 ReceiveNotices = 2048,
66 StartProposal = 4096,
67 LandDeed = 4096,
68 VoteOnProposal = 8192,
69 LandRelease = 8192,
70 LandSetSale = 16384,
71 LandDivideJoin = 32768,
72 ReturnGroupOwned = 65536,
73 JoinChat = 65536,
74 FindPlaces = 131072,
75 LandChangeIdentity = 262144,
76 SetLandingPoint = 524288,
77 ChangeMedia = 1048576,
78 LandEdit = 2097152,
79 LandOptions = 4194304,
80 AllowEditLand = 8388608,
81 AllowFly = 16777216,
82 AllowRez = 33554432,
83 AllowLandmark = 67108864,
84 AllowVoiceChat = 134217728,
85 AllowSetHome = 268435456,
86 LandManageAllowed = 536870912,
87 LandManageBanned = 1073741824
88 }
89
90namespace OpenSim.Region.CoreModules.World.Permissions 40namespace OpenSim.Region.CoreModules.World.Permissions
91{ 41{
92 public class PermissionsModule : IRegionModule 42 public class PermissionsModule : IRegionModule
@@ -214,7 +164,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
214 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; 164 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
215 m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED 165 m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED
216 m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED 166 m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED
217 m_scene.Permissions.OnEditParcel += CanEditParcel; //MAYBE FULLY IMPLEMENTED 167 m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties; //MAYBE FULLY IMPLEMENTED
218 m_scene.Permissions.OnInstantMessage += CanInstantMessage; 168 m_scene.Permissions.OnInstantMessage += CanInstantMessage;
219 m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; //NOT YET IMPLEMENTED 169 m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; //NOT YET IMPLEMENTED
220 m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED 170 m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED
@@ -1005,12 +955,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1005 return GenericObjectPermission(editorID, objectID, false); 955 return GenericObjectPermission(editorID, objectID, false);
1006 } 956 }
1007 957
1008 private bool CanEditParcel(UUID user, ILandObject parcel, Scene scene) 958 private bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p, Scene scene)
1009 { 959 {
1010 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 960 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1011 if (m_bypassPermissions) return m_bypassPermissionsValue; 961 if (m_bypassPermissions) return m_bypassPermissionsValue;
1012 962
1013 return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandDivideJoin); 963 return GenericParcelOwnerPermission(user, parcel, (ulong)p);
1014 } 964 }
1015 965
1016 /// <summary> 966 /// <summary>
diff --git a/OpenSim/Region/Framework/Interfaces/ILandObject.cs b/OpenSim/Region/Framework/Interfaces/ILandObject.cs
index 084184f..585eb00 100644
--- a/OpenSim/Region/Framework/Interfaces/ILandObject.cs
+++ b/OpenSim/Region/Framework/Interfaces/ILandObject.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Region.Framework.Interfaces
57 void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client); 57 void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client);
58 List<UUID> CreateAccessListArrayByFlag(AccessList flag); 58 List<UUID> CreateAccessListArrayByFlag(AccessList flag);
59 void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, IClientAPI remote_client); 59 void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, IClientAPI remote_client);
60 void UpdateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client); 60 void UpdateAccessList(uint flags, UUID transactionID, int sequenceID, int sections, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client);
61 void UpdateLandBitmapByteArray(); 61 void UpdateLandBitmapByteArray();
62 void SetLandBitmapFromByteArray(); 62 void SetLandBitmapFromByteArray();
63 bool[,] GetLandBitmap(); 63 bool[,] GetLandBitmap();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index ab0eed8..1295e58 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -722,20 +722,6 @@ namespace OpenSim.Region.Framework.Scenes
722 #endregion 722 #endregion
723 723
724 #region EDIT PARCEL 724 #region EDIT PARCEL
725 public bool CanEditParcel(UUID user, ILandObject parcel)
726 {
727 EditParcelHandler handler = OnEditParcel;
728 if (handler != null)
729 {
730 Delegate[] list = handler.GetInvocationList();
731 foreach (EditParcelHandler h in list)
732 {
733 if (h(user, parcel, m_scene) == false)
734 return false;
735 }
736 }
737 return true;
738 }
739 725
740 public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p) 726 public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p)
741 { 727 {
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
index ff0e743..4a24c7d 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs
@@ -1001,7 +1001,7 @@ namespace OpenSim.Region.RegionCombinerModule
1001 VirtualRegion.Permissions.OnDuplicateObject += BigRegion.PermissionModule.CanDuplicateObject; 1001 VirtualRegion.Permissions.OnDuplicateObject += BigRegion.PermissionModule.CanDuplicateObject;
1002 VirtualRegion.Permissions.OnDeleteObject += BigRegion.PermissionModule.CanDeleteObject; //MAYBE FULLY IMPLEMENTED 1002 VirtualRegion.Permissions.OnDeleteObject += BigRegion.PermissionModule.CanDeleteObject; //MAYBE FULLY IMPLEMENTED
1003 VirtualRegion.Permissions.OnEditObject += BigRegion.PermissionModule.CanEditObject; //MAYBE FULLY IMPLEMENTED 1003 VirtualRegion.Permissions.OnEditObject += BigRegion.PermissionModule.CanEditObject; //MAYBE FULLY IMPLEMENTED
1004 VirtualRegion.Permissions.OnEditParcel += BigRegion.PermissionModule.CanEditParcel; //MAYBE FULLY IMPLEMENTED 1004 VirtualRegion.Permissions.OnEditParcelProperties += BigRegion.PermissionModule.CanEditParcelProperties; //MAYBE FULLY IMPLEMENTED
1005 VirtualRegion.Permissions.OnInstantMessage += BigRegion.PermissionModule.CanInstantMessage; 1005 VirtualRegion.Permissions.OnInstantMessage += BigRegion.PermissionModule.CanInstantMessage;
1006 VirtualRegion.Permissions.OnInventoryTransfer += BigRegion.PermissionModule.CanInventoryTransfer; //NOT YET IMPLEMENTED 1006 VirtualRegion.Permissions.OnInventoryTransfer += BigRegion.PermissionModule.CanInventoryTransfer; //NOT YET IMPLEMENTED
1007 VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED 1007 VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
index 393322d..7c662c9 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs
@@ -105,9 +105,9 @@ namespace OpenSim.Region.RegionCombinerModule
105 return m_rootScene.Permissions.CanEditObject(objectid, editorid); 105 return m_rootScene.Permissions.CanEditObject(objectid, editorid);
106 } 106 }
107 107
108 public bool CanEditParcel(UUID user, ILandObject parcel, Scene scene) 108 public bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers g, Scene scene)
109 { 109 {
110 return m_rootScene.Permissions.CanEditParcel(user, parcel); 110 return m_rootScene.Permissions.CanEditParcelProperties(user, parcel, g);
111 } 111 }
112 112
113 public bool CanInstantMessage(UUID user, UUID target, Scene startscene) 113 public bool CanInstantMessage(UUID user, UUID target, Scene startscene)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 3c5f2d0..30fb252 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6287,16 +6287,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6287 { 6287 {
6288 m_host.AddScriptLPS(1); 6288 m_host.AddScriptLPS(1);
6289 UUID key; 6289 UUID key;
6290 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; 6290 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
6291 if (land.OwnerID == m_host.OwnerID) 6291 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed))
6292 { 6292 {
6293 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 6293 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
6294 if (UUID.TryParse(avatar, out key)) 6294 if (UUID.TryParse(avatar, out key))
6295 { 6295 {
6296 entry.AgentID = key; 6296 if (land.LandData.ParcelAccessList.FindIndex(
6297 entry.Flags = AccessList.Access; 6297 delegate(ParcelManager.ParcelAccessEntry e)
6298 entry.Time = DateTime.Now.AddHours(hours); 6298 {
6299 land.ParcelAccessList.Add(entry); 6299 if (e.AgentID == key && e.Flags == AccessList.Access)
6300 return true;
6301 return false;
6302 }) == -1)
6303 {
6304 entry.AgentID = key;
6305 entry.Flags = AccessList.Access;
6306 entry.Time = DateTime.Now.AddHours(hours);
6307 land.LandData.ParcelAccessList.Add(entry);
6308 }
6300 } 6309 }
6301 } 6310 }
6302 ScriptSleep(100); 6311 ScriptSleep(100);
@@ -9023,7 +9032,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9023 // according to the docs, this command only works if script owner and land owner are the same 9032 // according to the docs, this command only works if script owner and land owner are the same
9024 // lets add estate owners and gods, too, and use the generic permission check. 9033 // lets add estate owners and gods, too, and use the generic permission check.
9025 ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 9034 ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
9026 if (!World.Permissions.CanEditParcel(m_host.OwnerID, landObject)) return; 9035 if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, landObject, GroupPowers.ChangeMedia)) return;
9027 9036
9028 bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)? 9037 bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)?
9029 byte loop = 0; 9038 byte loop = 0;
@@ -9466,16 +9475,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9466 { 9475 {
9467 m_host.AddScriptLPS(1); 9476 m_host.AddScriptLPS(1);
9468 UUID key; 9477 UUID key;
9469 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; 9478 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
9470 if (land.OwnerID == m_host.OwnerID) 9479 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
9471 { 9480 {
9472 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 9481 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
9473 if (UUID.TryParse(avatar, out key)) 9482 if (UUID.TryParse(avatar, out key))
9474 { 9483 {
9475 entry.AgentID = key; 9484 if (land.LandData.ParcelAccessList.FindIndex(
9476 entry.Flags = AccessList.Ban; 9485 delegate(ParcelManager.ParcelAccessEntry e)
9477 entry.Time = DateTime.Now.AddHours(hours); 9486 {
9478 land.ParcelAccessList.Add(entry); 9487 if (e.AgentID == key && e.Flags == AccessList.Ban)
9488 return true;
9489 return false;
9490 }) == -1)
9491 {
9492 entry.AgentID = key;
9493 entry.Flags = AccessList.Ban;
9494 entry.Time = DateTime.Now.AddHours(hours);
9495 land.LandData.ParcelAccessList.Add(entry);
9496 }
9479 } 9497 }
9480 } 9498 }
9481 ScriptSleep(100); 9499 ScriptSleep(100);
@@ -9485,19 +9503,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9485 { 9503 {
9486 m_host.AddScriptLPS(1); 9504 m_host.AddScriptLPS(1);
9487 UUID key; 9505 UUID key;
9488 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; 9506 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
9489 if (land.OwnerID == m_host.OwnerID) 9507 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed))
9490 { 9508 {
9491 if (UUID.TryParse(avatar, out key)) 9509 if (UUID.TryParse(avatar, out key))
9492 { 9510 {
9493 foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) 9511 int idx = land.LandData.ParcelAccessList.FindIndex(
9494 { 9512 delegate(ParcelManager.ParcelAccessEntry e)
9495 if (entry.AgentID == key && entry.Flags == AccessList.Access) 9513 {
9496 { 9514 if (e.AgentID == key && e.Flags == AccessList.Access)
9497 land.ParcelAccessList.Remove(entry); 9515 return true;
9498 break; 9516 return false;
9499 } 9517 });
9500 } 9518
9519 if (idx != -1)
9520 land.LandData.ParcelAccessList.RemoveAt(idx);
9501 } 9521 }
9502 } 9522 }
9503 ScriptSleep(100); 9523 ScriptSleep(100);
@@ -9507,19 +9527,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9507 { 9527 {
9508 m_host.AddScriptLPS(1); 9528 m_host.AddScriptLPS(1);
9509 UUID key; 9529 UUID key;
9510 LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; 9530 ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
9511 if (land.OwnerID == m_host.OwnerID) 9531 if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
9512 { 9532 {
9513 if (UUID.TryParse(avatar, out key)) 9533 if (UUID.TryParse(avatar, out key))
9514 { 9534 {
9515 foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) 9535 int idx = land.LandData.ParcelAccessList.FindIndex(
9516 { 9536 delegate(ParcelManager.ParcelAccessEntry e)
9517 if (entry.AgentID == key && entry.Flags == AccessList.Ban) 9537 {
9518 { 9538 if (e.AgentID == key && e.Flags == AccessList.Ban)
9519 land.ParcelAccessList.Remove(entry); 9539 return true;
9520 break; 9540 return false;
9521 } 9541 });
9522 } 9542
9543 if (idx != -1)
9544 land.LandData.ParcelAccessList.RemoveAt(idx);
9523 } 9545 }
9524 } 9546 }
9525 ScriptSleep(100); 9547 ScriptSleep(100);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 3b13d06..5a796b8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1335,7 +1335,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1335 return; 1335 return;
1336 } 1336 }
1337 1337
1338 if (! World.Permissions.CanEditParcel(m_host.OwnerID, startLandObject)) 1338 if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions))
1339 { 1339 {
1340 OSSLShoutError("You do not have permission to modify the parcel"); 1340 OSSLShoutError("You do not have permission to modify the parcel");
1341 return; 1341 return;