diff options
author | UbitUmarov | 2017-07-12 01:44:34 +0100 |
---|---|---|
committer | UbitUmarov | 2017-07-12 01:44:34 +0100 |
commit | c8a9b0321f1e3ea724d8230ea1106b8bfd682fc3 (patch) | |
tree | 93f0dd5bb9c61a12085a6909cbbd4bfa511fa21f /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |
parent | remove wrong comment on lsl object rez. we can't add delays on async process (diff) | |
download | opensim-SC-c8a9b0321f1e3ea724d8230ea1106b8bfd682fc3.zip opensim-SC-c8a9b0321f1e3ea724d8230ea1106b8bfd682fc3.tar.gz opensim-SC-c8a9b0321f1e3ea724d8230ea1106b8bfd682fc3.tar.bz2 opensim-SC-c8a9b0321f1e3ea724d8230ea1106b8bfd682fc3.tar.xz |
osSetParcelDetails: place hard restrictions on change owner,claimdate (both estate owner or manager) and group (same plus parcel owner that also needes to be a member of the new group); add PARCEL_DETAILS_SEE_AVATARS, PARCEL_DETAILS_ANY_AVATAR_SOUNDS and PARCEL_DETAILS_GROUP_SOUNDS
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 115 |
1 files changed, 99 insertions, 16 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 22d247d..4bf8729 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -1606,13 +1606,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1606 | 1606 | ||
1607 | if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions, false)) | 1607 | if (!World.Permissions.CanEditParcelProperties(m_host.OwnerID, startLandObject, GroupPowers.LandOptions, false)) |
1608 | { | 1608 | { |
1609 | OSSLShoutError("You do not have permission to modify the parcel"); | 1609 | OSSLShoutError("script owner does not have permission to modify the parcel"); |
1610 | return; | 1610 | return; |
1611 | } | 1611 | } |
1612 | 1612 | ||
1613 | // Create a new land data object we can modify | 1613 | // Create a new land data object we can modify |
1614 | LandData newLand = startLandObject.LandData.Copy(); | 1614 | LandData newLand = startLandObject.LandData.Copy(); |
1615 | UUID uuid; | 1615 | UUID uuid; |
1616 | EstateSettings es = World.RegionInfo.EstateSettings; | ||
1617 | |||
1618 | bool changed = false; | ||
1616 | 1619 | ||
1617 | // Process the rules, not sure what the impact would be of changing owner or group | 1620 | // Process the rules, not sure what the impact would be of changing owner or group |
1618 | for (int idx = 0; idx < rules.Length;) | 1621 | for (int idx = 0; idx < rules.Length;) |
@@ -1622,35 +1625,115 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1622 | switch (code) | 1625 | switch (code) |
1623 | { | 1626 | { |
1624 | case ScriptBaseClass.PARCEL_DETAILS_NAME: | 1627 | case ScriptBaseClass.PARCEL_DETAILS_NAME: |
1625 | newLand.Name = arg; | 1628 | if(newLand.Name != arg) |
1629 | { | ||
1630 | newLand.Name = arg; | ||
1631 | changed = true; | ||
1632 | } | ||
1626 | break; | 1633 | break; |
1627 | 1634 | ||
1628 | case ScriptBaseClass.PARCEL_DETAILS_DESC: | 1635 | case ScriptBaseClass.PARCEL_DETAILS_DESC: |
1629 | newLand.Description = arg; | 1636 | if(newLand.Description != arg) |
1637 | { | ||
1638 | newLand.Description = arg; | ||
1639 | changed = true; | ||
1640 | } | ||
1630 | break; | 1641 | break; |
1631 | 1642 | ||
1632 | case ScriptBaseClass.PARCEL_DETAILS_OWNER: | 1643 | case ScriptBaseClass.PARCEL_DETAILS_OWNER: |
1633 | CheckThreatLevel(ThreatLevel.VeryHigh, functionName); | 1644 | if(es != null && !es.IsEstateManagerOrOwner(m_host.OwnerID)) |
1634 | if (UUID.TryParse(arg, out uuid)) | 1645 | { |
1635 | newLand.OwnerID = uuid; | 1646 | OSSLError("script owner does not have permission to modify the parcel owner"); |
1647 | } | ||
1648 | else | ||
1649 | { | ||
1650 | if (UUID.TryParse(arg, out uuid)) | ||
1651 | { | ||
1652 | if(newLand.OwnerID != uuid) | ||
1653 | { | ||
1654 | changed = true; | ||
1655 | newLand.OwnerID = uuid; | ||
1656 | newLand.GroupID = UUID.Zero; | ||
1657 | } | ||
1658 | } | ||
1659 | } | ||
1636 | break; | 1660 | break; |
1637 | 1661 | ||
1638 | case ScriptBaseClass.PARCEL_DETAILS_GROUP: | 1662 | case ScriptBaseClass.PARCEL_DETAILS_GROUP: |
1639 | CheckThreatLevel(ThreatLevel.VeryHigh, functionName); | 1663 | if(m_host.OwnerID == newLand.OwnerID || es == null || es.IsEstateManagerOrOwner(m_host.OwnerID)) |
1640 | if (UUID.TryParse(arg, out uuid)) | 1664 | { |
1641 | newLand.GroupID = uuid; | 1665 | if (UUID.TryParse(arg, out uuid)) |
1666 | { | ||
1667 | if(newLand.GroupID != uuid) | ||
1668 | { | ||
1669 | IGroupsModule groupsModule = m_ScriptEngine.World.RequestModuleInterface<IGroupsModule>(); | ||
1670 | GroupMembershipData member = null; | ||
1671 | if (groupsModule != null) | ||
1672 | member = groupsModule.GetMembershipData(uuid, newLand.OwnerID); | ||
1673 | if (member == null) | ||
1674 | OSSLError(string.Format("land owner is not member of the new group for parcel")); | ||
1675 | else | ||
1676 | { | ||
1677 | changed = true; | ||
1678 | newLand.GroupID = uuid; | ||
1679 | } | ||
1680 | } | ||
1681 | } | ||
1682 | } | ||
1683 | else | ||
1684 | { | ||
1685 | OSSLError("script owner does not have permission to modify the parcel group"); | ||
1686 | } | ||
1642 | break; | 1687 | break; |
1643 | 1688 | ||
1644 | case ScriptBaseClass.PARCEL_DETAILS_CLAIMDATE: | 1689 | case ScriptBaseClass.PARCEL_DETAILS_CLAIMDATE: |
1645 | CheckThreatLevel(ThreatLevel.VeryHigh, functionName); | 1690 | if(es != null && !es.IsEstateManagerOrOwner(m_host.OwnerID)) |
1646 | newLand.ClaimDate = Convert.ToInt32(arg); | 1691 | { |
1647 | if (newLand.ClaimDate == 0) | 1692 | OSSLError("script owner does not have permission to modify the parcel CLAIM DATE"); |
1648 | newLand.ClaimDate = Util.UnixTimeSinceEpoch(); | 1693 | } |
1694 | else | ||
1695 | { | ||
1696 | int date = Convert.ToInt32(arg); | ||
1697 | if (date == 0) | ||
1698 | date = Util.UnixTimeSinceEpoch(); | ||
1699 | if(newLand.ClaimDate != date) | ||
1700 | { | ||
1701 | changed = true; | ||
1702 | newLand.ClaimDate = date; | ||
1703 | } | ||
1704 | } | ||
1649 | break; | 1705 | break; |
1650 | } | ||
1651 | } | ||
1652 | 1706 | ||
1653 | World.LandChannel.UpdateLandObject(newLand.LocalID,newLand); | 1707 | case ScriptBaseClass.PARCEL_DETAILS_SEE_AVATARS: |
1708 | bool newavs = (Convert.ToInt32(arg) != 0); | ||
1709 | if(newLand.SeeAVs != newavs) | ||
1710 | { | ||
1711 | changed = true; | ||
1712 | newLand.SeeAVs = newavs; | ||
1713 | } | ||
1714 | break; | ||
1715 | |||
1716 | case ScriptBaseClass.PARCEL_DETAILS_ANY_AVATAR_SOUNDS: | ||
1717 | bool newavsounds = (Convert.ToInt32(arg) != 0); | ||
1718 | if(newLand.AnyAVSounds != newavsounds) | ||
1719 | { | ||
1720 | changed = true; | ||
1721 | newLand.AnyAVSounds = newavsounds; | ||
1722 | } | ||
1723 | break; | ||
1724 | |||
1725 | case ScriptBaseClass.PARCEL_DETAILS_GROUP_SOUNDS: | ||
1726 | bool newgrpsounds = (Convert.ToInt32(arg) != 0); | ||
1727 | if(newLand.GroupAVSounds != newgrpsounds) | ||
1728 | { | ||
1729 | changed = true; | ||
1730 | newLand.GroupAVSounds = newgrpsounds; | ||
1731 | } | ||
1732 | break; | ||
1733 | } | ||
1734 | } | ||
1735 | if(changed) | ||
1736 | World.LandChannel.UpdateLandObject(newLand.LocalID,newLand); | ||
1654 | } | 1737 | } |
1655 | 1738 | ||
1656 | public double osList2Double(LSL_Types.list src, int index) | 1739 | public double osList2Double(LSL_Types.list src, int index) |