Exemplo n.º 1
0
        public void setup()
        {
            // setup LandData object
            this.land = new LandData();
            this.land.AABBMax = new Vector3(0, 0, 0);
            this.land.AABBMin = new Vector3(128, 128, 128);
            this.land.Area = 128;
            this.land.AuctionID = 0;
            this.land.AuthBuyerID = new UUID();
            this.land.Category = ParcelCategory.Residential;
            this.land.ClaimDate = 0;
            this.land.ClaimPrice = 0;
            this.land.GlobalID = new UUID("54ff9641-dd40-4a2c-b1f1-47dd3af24e50");
            this.land.GroupID = new UUID("d740204e-bbbf-44aa-949d-02c7d739f6a5");
            this.land.GroupPrims = 0;
            this.land.Description = "land data to test LandDataSerializer";
            this.land.Flags = (uint)(ParcelFlags.AllowDamage | ParcelFlags.AllowVoiceChat);
            this.land.LandingType = (byte)LandingType.Direct;
            this.land.Name = "LandDataSerializerTest Land";
            this.land.Status = ParcelStatus.Leased;
            this.land.LocalID = 0;
            this.land.MediaAutoScale = (byte)0x01;
            this.land.MediaID = new UUID("d4452578-2f25-4b97-a81b-819af559cfd7");
            this.land.MediaURL = "http://videos.opensimulator.org/bumblebee.mp4";
            this.land.OwnerID = new UUID("1b8eedf9-6d15-448b-8015-24286f1756bf");

            this.landWithParcelAccessList = this.land.Copy();
            this.landWithParcelAccessList.ParcelAccessList.Clear();

            ParcelManager.ParcelAccessEntry pae0 = new ParcelManager.ParcelAccessEntry();
            pae0.AgentID = new UUID("62d65d45-c91a-4f77-862c-46557d978b6c");
            pae0.Flags = AccessList.Ban;
            pae0.Time = new DateTime(2009, 10, 01);
            this.landWithParcelAccessList.ParcelAccessList.Add(pae0);

            ParcelManager.ParcelAccessEntry pae1 = new ParcelManager.ParcelAccessEntry();
            pae1.AgentID = new UUID("ec2a8d18-2378-4fe0-8b68-2a31b57c481e");
            pae1.Flags = AccessList.Access;
            pae1.Time = new DateTime(2010, 10, 20);
            this.landWithParcelAccessList.ParcelAccessList.Add(pae1);
        }
 private void BuildParcelAccessList(LandData LandData)
 {
     List<string> Query = GD.Query("ParcelID", LandData.GlobalID, "parcelaccess", "AccessID, Flags, Time");
     int i = 0;
     int dataCount = 0;
     ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
     foreach (string retVal in Query)
     {
         if (dataCount == 0)
             entry.AgentID = UUID.Parse(Query[i]);
         if (dataCount == 1)
             entry.Flags = (AccessList)int.Parse(Query[i]);
         if (dataCount == 2)
             entry.Time = new DateTime(long.Parse(Query[i]));
         dataCount++;
         i++;
         if (dataCount == 3)
         {
             LandData.ParcelAccessList.Add(entry);
             entry = new ParcelManager.ParcelAccessEntry();
             dataCount = 0;
         }
     }
 }
Exemplo n.º 3
0
 ///<summary>
 ///</summary>
 ///<param name = "row"></param>
 ///<returns></returns>
 private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataReader row)
 {
     ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry
                                                 {
                                                     AgentID = DBGuid.FromDB(row["AccessUUID"]),
                                                     Flags = (AccessList) Convert.ToInt32(row["Flags"]),
                                                     Time = new DateTime()
                                                 };
     return entry;
 }
Exemplo n.º 4
0
        public bool IsRestrictedFromLand(UUID avatar)
        {
            if (m_scene.Permissions.IsAdministrator(avatar))
                return false;

            if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0)
            {
                ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
                entry.AgentID = avatar;
                entry.Flags = AccessList.Access;
                entry.Time = new DateTime();
                entry = LandData.ParcelAccessList.Find(delegate(ParcelManager.ParcelAccessEntry pae)
                {
                    if (entry.AgentID == pae.AgentID && entry.Flags == pae.Flags)
                        return true;
                    return false;
                });

                //If they are not on the access list and are not the owner
                if (entry.AgentID == avatar && LandData.OwnerID != avatar)
                {
                    if ((LandData.Flags & (uint)ParcelFlags.UseAccessGroup) > 0)
                    {
                        IScenePresence SP = m_scene.GetScenePresence (avatar);
                        if (SP != null && LandData.GroupID == SP.ControllingClient.ActiveGroupId)
                        {
                            //They are a part of the group, let them in
                            return false;
                        }
                        else
                        {
                            //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
                            return true;
                        }
                    }
                    else
                    {
                        //No group checking, not on the access list, restricted
                        return true;
                    }
                }
                else
                {
                    //If it does, we need to check the time
                    entry = LandData.ParcelAccessList.Find(delegate (ParcelManager.ParcelAccessEntry item)
                    {
                        if(item.AgentID == entry.AgentID && item.Flags == entry.Flags)
                            return true;
                        return false;
                    });

                    if (entry.Time.Ticks < DateTime.Now.Ticks)
                    {
                        //Time expired, remove them
                        LandData.ParcelAccessList.Remove(entry);
                        return true;
                    }
                }
            }
            return false;
        }
        public void ParcelBuyPass(IClientAPI client, UUID agentID, int ParcelLocalID)
        {
            ILandObject landObject = GetLandObject(ParcelLocalID);
            if (landObject == null)
            {
                client.SendAlertMessage("Could not find the parcel you are currently on.");
                return;
            }

            if (landObject.IsBannedFromLand(agentID))
            {
                client.SendAlertMessage("You cannot buy a pass as you are banned from this parcel.");
                return;
            }

            IMoneyModule module = m_scene.RequestModuleInterface<IMoneyModule>();
            if (module != null)
                if (
                    !module.Transfer(landObject.LandData.OwnerID, client.AgentId, landObject.LandData.PassPrice,
                                     "Parcel Pass"))
                {
                    client.SendAlertMessage("You do not have enough funds to complete this transaction.");
                    return;
                }

            ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry
                                                        {
                                                            AgentID = agentID,
                                                            Flags = AccessList.Access,
                                                            Time = DateTime.Now.AddHours(landObject.LandData.PassHours)
                                                        };
            landObject.LandData.ParcelAccessList.Add(entry);
            client.SendAgentAlertMessage("You have been added to the parcel access list.", false);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Builds the landaccess data from a data record.
 /// </summary>
 /// <param name="row">datarecord with landaccess data</param>
 /// <returns></returns>
 private static ParcelManager.ParcelAccessEntry BuildLandAccessData(IDataRecord row)
 {
     ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
     entry.AgentID = new UUID((Guid)row["AccessUUID"]);
     entry.Flags = (AccessList)Convert.ToInt32(row["Flags"]);
     entry.Time = new DateTime();
     return entry;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Build a land access entry from the persisted data.
 /// </summary>
 /// <param name="row"></param>
 /// <returns></returns>
 private ParcelManager.ParcelAccessEntry buildLandAccessData(DataRow row)
 {
     ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
     entry.AgentID = new UUID((string) row["AccessUUID"]);
     entry.Flags = (AccessList) row["Flags"];
     entry.Time = new DateTime();
     return entry;
 }
Exemplo n.º 8
0
        public bool IsRestrictedFromLand(UUID avatar)
        {
            if (m_scene.Permissions.IsAdministrator(avatar))
                return false;

            if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0)
            {
                ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
                entry.AgentID = avatar;
                entry.Flags = AccessList.Access;
                entry.Time = new DateTime();

                //If they are not on the access list and are not the owner
                if (!LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar)
                {
                    //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
                    return true;
                }
            }
            return false;
        }
Exemplo n.º 9
0
 public void llAddToLandBanList(string avatar, double hours)
 {
     m_host.AddScriptLPS(1);
     UUID key;
     ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
     if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned))
     {
         ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
         if (UUID.TryParse(avatar, out key))
         {
             if (land.LandData.ParcelAccessList.FindIndex(
                     delegate(ParcelManager.ParcelAccessEntry e)
                     {
                         if (e.AgentID == key && e.Flags == AccessList.Ban)
                             return true;
                         return false;
                     }) == -1)
             {
                 entry.AgentID = key;
                 entry.Flags = AccessList.Ban;
                 entry.Time = DateTime.Now.AddHours(hours);
                 land.LandData.ParcelAccessList.Add(entry);
             }
         }
     }
     ScriptSleep(100);
 }
Exemplo n.º 10
0
        public void UpdateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client)
        {
            if (entries.Count == 1 && entries[0].AgentID == UUID.Zero)
                entries.Clear();

#if (!ISWIN)
            List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>();
            foreach (ParcelManager.ParcelAccessEntry entry in LandData.ParcelAccessList)
            {
                if (entry.Flags == (AccessList) flags) toRemove.Add(entry);
            }
#else
            List<ParcelManager.ParcelAccessEntry> toRemove =
                LandData.ParcelAccessList.Where(entry => entry.Flags == (AccessList) flags).ToList();
#endif

            foreach (ParcelManager.ParcelAccessEntry entry in toRemove)
            {
                LandData.ParcelAccessList.Remove(entry);
            }
#if (!ISWIN)
            foreach (ParcelManager.ParcelAccessEntry entry in entries)
            {
                ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry
                                                           {
                                                               AgentID = entry.AgentID,
                                                               Time = DateTime.MaxValue,
                                                               Flags = (AccessList) flags
                                                           };
                if (!LandData.ParcelAccessList.Contains(temp))
                {
                    LandData.ParcelAccessList.Add(temp);
                }
            }
#else
            foreach (ParcelManager.ParcelAccessEntry temp in entries.Select(entry => new ParcelManager.ParcelAccessEntry
                                                                           {
                                                                               AgentID = entry.AgentID,
                                                                               Time = DateTime.MaxValue,
                                                                               Flags = (AccessList) flags
                                                                           }).Where(temp => !LandData.ParcelAccessList.Contains(temp)))
            {
                LandData.ParcelAccessList.Add(temp);
            }
#endif

            m_parcelManagementModule.UpdateLandObject(this);
        }
Exemplo n.º 11
0
        public void updateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client)
        {
            LandData newData = landData.Copy();

            if (entries.Count == 1 && entries[0].AgentID == UUID.Zero)
            {
                entries.Clear();
            }

            List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>();
            foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList)
            {
                if (entry.Flags == (AccessList)flags)
                {
                    toRemove.Add(entry);
                }
            }

            foreach (ParcelManager.ParcelAccessEntry entry in toRemove)
            {
                newData.ParcelAccessList.Remove(entry);
            }
            foreach (ParcelManager.ParcelAccessEntry entry in entries)
            {
                ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry();
                temp.AgentID = entry.AgentID;
                temp.Time = new DateTime(); //Pointless? Yes.
                temp.Flags = (AccessList)flags;

                if (!newData.ParcelAccessList.Contains(temp))
                {
                    newData.ParcelAccessList.Add(temp);
                }
            }

            m_log.InfoFormat("[LAND]: updateAccessList for land parcel {0} [{1}] flags {2} -> {3} by {4}",
                newData.LocalID, newData.GlobalID, landData.Flags.ToString("X8"), newData.Flags.ToString("X8"), remote_client.Name);
            m_scene.LandChannel.UpdateLandObject(landData.LocalID, newData);
        }
Exemplo n.º 12
0
        public bool isRestrictedFromLand(UUID avatar)
        {
            if (m_scene.Permissions.BypassPermissions())
                return false;

            // Is everyone allowed in? Most common case, just permit entry.
            if ((landData.Flags & (uint)ParcelFlags.UseAccessList) == 0)
                return false;

            // Land owner always has access. Just permit entry.
            if (landData.OwnerID == avatar)
                return false;

            // Not public access, not the owner. Check other overrides.

            // Check if this user is listed with access.
            if (landData.ParcelAccessList.Count != 0)
            {
                ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
                entry.AgentID = avatar;
                entry.Flags = AccessList.Access;
                entry.Time = new DateTime();
                if (landData.ParcelAccessList.Contains(entry))
                    return false;   // explicitly permitted to enter
            }

            // Note: AllowAccessEstatewide is potentially slightly expensive due to partner check profile lookup.
            if (AllowAccessEstatewide(avatar))
                return false;

            if (landData.GroupID != UUID.Zero)  // It has a group set.
            {
                // If it's group-owned land or group-based access enabled, allow in group members.
                if (landData.IsGroupOwned || ((landData.Flags & (uint)ParcelFlags.UseAccessGroup) != 0))
                {
                    // FastConfirmGroupMember is light if the avatar has a root or child connection to this region.
                    if (m_scene.FastConfirmGroupMember(avatar, landData.GroupID))
                        return false;
                }
            }

            // Parcel not public access and no qualifications to allow in.
            return true;
        }
Exemplo n.º 13
0
        public bool isBannedFromLand(UUID avatar)
        {
            if (m_scene.Permissions.BypassPermissions())
                return false;

            if (landData.OwnerID == avatar)
                return false;

            ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
            entry.AgentID = avatar;
            entry.Flags = AccessList.Ban;
            entry.Time = new DateTime();
            if (landData.ParcelAccessList.Contains(entry))
            {
                // Banned, but ignore if EO etc?  Delay this call to here because
                // this call is potentially slightly expensive due to partner check profile lookup.
                if (!AllowAccessEstatewide(avatar))
                    return true;
            }

            return false;
        }
Exemplo n.º 14
0
 public bool isBannedFromLand(UUID avatar)
 {
     if ((landData.Flags & (uint) ParcelFlags.UseBanList) > 0)
     {
         ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
         entry.AgentID = avatar;
         entry.Flags = AccessList.Ban;
         entry.Time = new DateTime();
         if (landData.ParcelAccessList.Contains(entry))
         {
             //They are banned, so lets send them a notice about this parcel
             return true;
         }
     }
     return false;
 }
Exemplo n.º 15
0
        /// <summary>
        ///   Make a new copy of the land data
        /// </summary>
        /// <returns></returns>
        public LandData Copy()
        {
            LandData landData = new LandData
                                    {
                                        _AABBMax = _AABBMax,
                                        _AABBMin = _AABBMin,
                                        _area = _area,
                                        _auctionID = _auctionID,
                                        _authBuyerID = _authBuyerID,
                                        _category = _category,
                                        _claimDate = _claimDate,
                                        _claimPrice = _claimPrice,
                                        _globalID = _globalID,
                                        _groupID = _groupID,
                                        _isGroupOwned = _isGroupOwned,
                                        _localID = _localID,
                                        _landingType = _landingType,
                                        _mediaAutoScale = _mediaAutoScale,
                                        _mediaID = _mediaID,
                                        _mediaURL = _mediaURL,
                                        _musicURL = _musicURL,
                                        _ownerID = _ownerID,
                                        _bitmap = (byte[]) _bitmap.Clone(),
                                        _description = _description,
                                        _flags = _flags,
                                        _name = _name,
                                        _status = _status,
                                        _passHours = _passHours,
                                        _passPrice = _passPrice,
                                        _salePrice = _salePrice,
                                        _snapshotID = _snapshotID,
                                        _userLocation = _userLocation,
                                        _userLookAt = _userLookAt,
                                        _otherCleanTime = _otherCleanTime,
                                        _dwell = _dwell,
                                        _mediaType = _mediaType,
                                        _mediaDescription = _mediaDescription,
                                        _mediaWidth = _mediaWidth,
                                        _mediaHeight = _mediaHeight,
                                        _mediaLoop = _mediaLoop,
                                        _MediaLoopSet = _MediaLoopSet,
                                        _obscureMusic = _obscureMusic,
                                        _obscureMedia = _obscureMedia,
                                        _regionID = _regionID,
                                        _regionHandle = _regionHandle,
                                        _infoUUID = _infoUUID,
                                        _Maturity = _Maturity,
                                        _private = _private
                                    };


            landData._parcelAccessList.Clear();
#if (!ISWIN)
            foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList)
            {
                ParcelManager.ParcelAccessEntry newEntry = new ParcelManager.ParcelAccessEntry
                                                               {
                                                                   AgentID = entry.AgentID, Flags = entry.Flags, Time = entry.Time
                                                               };
                landData._parcelAccessList.Add(newEntry);
            }
#else
            foreach (ParcelManager.ParcelAccessEntry newEntry in _parcelAccessList.Select(entry => new ParcelManager.ParcelAccessEntry
                                                                                         {
                                                                                             AgentID = entry.AgentID,
                                                                                             Flags = entry.Flags,
                                                                                             Time = entry.Time
                                                                                         }))
            {
                landData._parcelAccessList.Add(newEntry);
            }
#endif

            return landData;
        }
Exemplo n.º 16
0
        // BanUser() includes land parcel permissions checks and returns false if not permitted.
        public bool BanUser(IClientAPI client, ILandObject land, ScenePresence target_presence)
        {
            if (land == null) return false;
            if (target_presence == null) return false;
            if (target_presence.IsBot) return false;

            if (!m_scene.Permissions.CanEditParcel(client.AgentId, land, GroupPowers.LandManageBanned))
                return false;

            ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
            entry.AgentID = target_presence.UUID;
            entry.Flags = AccessList.Ban;
            entry.Time = new DateTime();
            land.landData.ParcelAccessList.Add(entry);
            return true;
        }
Exemplo n.º 17
0
 public void llAddToLandBanList(string avatar, double hours)
 {
     m_host.AddScriptLPS(1);
     UUID key;
     LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData;
     if (land.OwnerID == m_host.OwnerID)
     {
         ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
         if (UUID.TryParse(avatar, out key))
         {
             entry.AgentID = key;
             entry.Flags = AccessList.Ban;
             entry.Time = DateTime.Now.AddHours(hours);
             land.ParcelAccessList.Add(entry);
         }
     }
     ScriptSleep(100);
 }
 /// <summary>
 /// Rebuild the access list from the database
 /// </summary>
 /// <param name="LandData"></param>
 private void BuildParcelAccessList(LandData LandData)
 {
     List<string> Query = GD.Query("ParcelID", LandData.GlobalID, "parcelaccess", "AccessID, Flags, Time");
     ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
     for(int i = 0; i < Query.Count; i += 3)
     {
         entry.AgentID = UUID.Parse(Query[i]);
         entry.Flags = (AccessList)Enum.Parse(typeof(AccessList), Query[i + 1]);
         entry.Time = new DateTime(long.Parse(Query[i+2]));
         LandData.ParcelAccessList.Add(entry);
         entry = new ParcelManager.ParcelAccessEntry();
     }
 }
Exemplo n.º 19
0
        /// <summary>
        /// Make a new copy of the land data
        /// </summary>
        /// <returns></returns>
        public LandData Copy()
        {
            LandData landData = new LandData();

            landData._AABBMax = _AABBMax;
            landData._AABBMin = _AABBMin;
            landData._area = _area;
            landData._auctionID = _auctionID;
            landData._authBuyerID = _authBuyerID;
            landData._category = _category;
            landData._claimDate = _claimDate;
            landData._claimPrice = _claimPrice;
            landData._globalID = _globalID;
            landData._groupID = _groupID;
            landData._isGroupOwned = _isGroupOwned;
            landData._localID = _localID;
            landData._landingType = _landingType;
            landData._mediaAutoScale = _mediaAutoScale;
            landData._mediaID = _mediaID;
            landData._mediaURL = _mediaURL;
            landData._musicURL = _musicURL;
            landData._ownerID = _ownerID;
            landData._bitmap = (byte[]) _bitmap.Clone();
            landData._description = _description;
            landData._flags = _flags;
            landData._name = _name;
            landData._status = _status;
            landData._passHours = _passHours;
            landData._passPrice = _passPrice;
            landData._salePrice = _salePrice;
            landData._snapshotID = _snapshotID;
            landData._userLocation = _userLocation;
            landData._userLookAt = _userLookAt;
            landData._otherCleanTime = _otherCleanTime;
            landData._dwell = _dwell;
            landData._mediaType = _mediaType;
            landData._mediaDescription = _mediaDescription;
            landData._mediaWidth = _mediaWidth;
            landData._mediaHeight = _mediaHeight;
            landData._mediaLoop = _mediaLoop;
            landData._MediaLoopSet = _MediaLoopSet;
            landData._obscureMusic = _obscureMusic;
            landData._obscureMedia = _obscureMedia;
            landData._regionID = _regionID;
            landData._regionHandle = _regionHandle;
            landData._infoUUID = _infoUUID;
            landData._Maturity = _Maturity;
            landData._private = _private;

            landData._parcelAccessList.Clear();
            foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList)
            {
                ParcelManager.ParcelAccessEntry newEntry = new ParcelManager.ParcelAccessEntry();
                newEntry.AgentID = entry.AgentID;
                newEntry.Flags = entry.Flags;
                newEntry.Time = entry.Time;

                landData._parcelAccessList.Add(newEntry);
            }

            return landData;
        }
Exemplo n.º 20
0
 public DateTime llAddToLandBanList(string avatar, double hours)
 {
     ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
     
     UUID key;
     LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData;
     if (land.OwnerID == m_host.OwnerID)
     {
         ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
         if (UUID.TryParse(avatar, out key))
         {
             entry.AgentID = key;
             entry.Flags = AccessList.Ban;
             entry.Time = DateTime.Now.AddHours(hours);
             land.ParcelAccessList.Add(entry);
         }
     }
     return PScriptSleep(100);
 }
Exemplo n.º 21
0
 public DateTime llAddToLandPassList(string avatar, double hours)
 {
     ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL");
     
     UUID key;
     IParcelManagementModule parcelManagement = World.RequestModuleInterface<IParcelManagementModule>();
     if (parcelManagement != null)
     {
         LandData land = parcelManagement.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData;
         if (land.OwnerID == m_host.OwnerID)
         {
             ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
             if (UUID.TryParse(avatar, out key))
             {
                 entry.AgentID = key;
                 entry.Flags = AccessList.Access;
                 entry.Time = DateTime.Now.AddHours(hours);
                 land.ParcelAccessList.Add(entry);
             }
         }
     }
     return PScriptSleep(100);
 }
Exemplo n.º 22
0
 public bool IsBannedFromLand(UUID avatar)
 {
     if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0)
     {
         ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
         entry.AgentID = avatar;
         entry.Flags = AccessList.Ban;
         entry.Time = new DateTime();
         //See if they are on the list, but make sure the owner isn't banned
         if (LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar)
         {
             //They are banned, so lets send them a notice about this parcel
             return true;
         }
     }
     return false;
 }
Exemplo n.º 23
0
        public void UpdateAccessList(uint flags, UUID transactionID,
                int sequenceID, int sections,
                List<ParcelManager.ParcelAccessEntry> entries,
                IClientAPI remote_client)
        {
            LandData newData = LandData.Copy();

            if ((!m_listTransactions.ContainsKey(flags)) ||
                    m_listTransactions[flags] != transactionID)
            {
                m_listTransactions[flags] = transactionID;

                List<ParcelManager.ParcelAccessEntry> toRemove =
                        new List<ParcelManager.ParcelAccessEntry>();

                foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList)
                {
                    if (entry.Flags == (AccessList)flags)
                        toRemove.Add(entry);
                }

                foreach (ParcelManager.ParcelAccessEntry entry in toRemove)
                {
                    newData.ParcelAccessList.Remove(entry);
                }

                // Checked here because this will always be the first
                // and only packet in a transaction
                if (entries.Count == 1 && entries[0].AgentID == UUID.Zero)
                {
                    m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);

                    return;
                }
            }

            foreach (ParcelManager.ParcelAccessEntry entry in entries)
            {
                ParcelManager.ParcelAccessEntry temp =
                        new ParcelManager.ParcelAccessEntry();

                temp.AgentID = entry.AgentID;
                temp.Time = entry.Time;
                temp.Flags = (AccessList)flags;

                newData.ParcelAccessList.Add(temp);
            }

            m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
        }
Exemplo n.º 24
0
 public bool IsRestrictedFromLand(UUID avatar)
 {
     if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0)
     {
         ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
         entry.AgentID = avatar;
         entry.Flags = AccessList.Access;
         entry.Time = new DateTime();
         if (!LandData.ParcelAccessList.Contains(entry))
         {
             //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
             return true;
         }
     }
     return false;
 }
Exemplo n.º 25
0
        public bool IsRestrictedFromLand(UUID avatar)
        {
            if (m_scene.Permissions.GenericParcelPermission(avatar, this, (ulong) 1))
                return false;

            if ((LandData.Flags & (uint) ParcelFlags.UsePassList) > 0 ||
                (LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0)
            {
                if (LandData.ParcelAccessList.Count > 0)
                {
                    ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
                    bool found = false;
                    foreach (
                        ParcelManager.ParcelAccessEntry pae in
                            LandData.ParcelAccessList.Where(
                                pae => avatar == pae.AgentID && AccessList.Access == pae.Flags))
                    {
                        found = true;
                        entry = pae;
                        break;
                    }

                    //If they are not on the access list and are not the owner
                    if (!found)
                    {
                        if ((LandData.Flags & (uint) ParcelFlags.UseAccessGroup) != 0)
                        {
                            IScenePresence SP = m_scene.GetScenePresence(avatar);
                            if (SP != null && LandData.GroupID == SP.ControllingClient.ActiveGroupId)
                            {
                                //They are a part of the group, let them in
                                return false;
                            }
                            else
                            {
                                //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
                                return true;
                            }
                        }
                        else
                        {
                            //No group checking, not on the access list, restricted
                            return true;
                        }
                    }
                    else
                    {
                        //If it does, we need to check the time
                        if (entry.Time.Ticks < DateTime.Now.Ticks)
                        {
                            //Time expired, remove them
                            LandData.ParcelAccessList.Remove(entry);
                            return true;
                        }
                        return false;
                    }
                }
                else if ((LandData.Flags & (uint) ParcelFlags.UseAccessGroup) > 0)
                {
                    IScenePresence SP = m_scene.GetScenePresence(avatar);
                    if (SP != null && LandData.GroupID == SP.ControllingClient.ActiveGroupId)
                    {
                        //They are a part of the group, let them in
                        return false;
                    }
                    else
                    {
                        //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
                        return true;
                    }
                }
                return true;
            }
            return false;
        }
Exemplo n.º 26
0
        /// <summary>
        ///     Reify/deserialize landData
        /// </summary>
        /// <param name="serializedLandData"></param>
        /// <returns></returns>
        /// <exception cref="System.Xml.XmlException"></exception>
        public static LandData Deserialize(string serializedLandData)
        {
            LandData landData = new LandData ();

            StringReader sr = new StringReader (serializedLandData);
            XmlTextReader xtr = new XmlTextReader (sr);

            xtr.ReadStartElement ("LandData");

            landData.Area = Convert.ToInt32 (xtr.ReadElementString ("Area"));
            landData.AuctionID = Convert.ToUInt32 (xtr.ReadElementString ("AuctionID"));
            landData.AuthBuyerID = UUID.Parse (xtr.ReadElementString ("AuthBuyerID"));
            landData.Category = (ParcelCategory)Convert.ToSByte (xtr.ReadElementString ("Category"));
            landData.ClaimDate = Convert.ToInt32 (xtr.ReadElementString ("ClaimDate"));
            landData.ClaimPrice = Convert.ToInt32 (xtr.ReadElementString ("ClaimPrice"));
            landData.GlobalID = UUID.Parse (xtr.ReadElementString ("GlobalID"));
            landData.GroupID = UUID.Parse (xtr.ReadElementString ("GroupID"));
            landData.IsGroupOwned = Convert.ToBoolean (xtr.ReadElementString ("IsGroupOwned"));
            landData.Bitmap = Convert.FromBase64String (xtr.ReadElementString ("Bitmap"));
            landData.Description = xtr.ReadElementString ("Description");
            landData.Flags = Convert.ToUInt32 (xtr.ReadElementString ("Flags"));
            landData.LandingType = Convert.ToByte (xtr.ReadElementString ("LandingType"));
            landData.Name = xtr.ReadElementString ("Name");
            landData.Status = (ParcelStatus)Convert.ToSByte (xtr.ReadElementString ("Status"));
            landData.LocalID = Convert.ToInt32 (xtr.ReadElementString ("LocalID"));
            landData.MediaAutoScale = Convert.ToByte (xtr.ReadElementString ("MediaAutoScale"));
            landData.MediaID = UUID.Parse (xtr.ReadElementString ("MediaID"));
            landData.MediaURL = xtr.ReadElementString ("MediaURL");
            landData.MusicURL = xtr.ReadElementString ("MusicURL");
            landData.OwnerID = UUID.Parse (xtr.ReadElementString ("OwnerID"));

            landData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry> ();
            xtr.Read ();
            if (xtr.Name != "ParcelAccessList")
                throw new XmlException (string.Format ("Expected \"ParcelAccessList\" element but got \"{0}\"", xtr.Name));

            if (!xtr.IsEmptyElement) {
                while (xtr.Read () && xtr.NodeType != XmlNodeType.EndElement) {
                    ParcelManager.ParcelAccessEntry pae = new ParcelManager.ParcelAccessEntry ();

                    xtr.ReadStartElement ("ParcelAccessEntry");
                    pae.AgentID = UUID.Parse (xtr.ReadElementString ("AgentID"));
                    xtr.ReadElementString ("Time");
                    pae.Flags = (AccessList)Convert.ToUInt32 (xtr.ReadElementString ("AccessList"));
                    pae.Time = DateTime.UtcNow;
                    xtr.ReadEndElement ();

                    landData.ParcelAccessList.Add (pae);
                }
            }
            xtr.Read ();

            landData.PassHours = Convert.ToSingle (xtr.ReadElementString ("PassHours"));
            landData.PassPrice = Convert.ToInt32 (xtr.ReadElementString ("PassPrice"));
            landData.SalePrice = Convert.ToInt32 (xtr.ReadElementString ("SalePrice"));
            landData.SnapshotID = UUID.Parse (xtr.ReadElementString ("SnapshotID"));
            landData.UserLocation = Vector3.Parse (xtr.ReadElementString ("UserLocation"));
            landData.UserLookAt = Vector3.Parse (xtr.ReadElementString ("UserLookAt"));
            // No longer used here
            xtr.ReadElementString ("Dwell");
            landData.OtherCleanTime = Convert.ToInt32 (xtr.ReadElementString ("OtherCleanTime"));

            xtr.ReadEndElement ();

            xtr.Close ();
            sr.Close ();

            return landData;
        }
Exemplo n.º 27
0
        public bool IsBannedFromLand(UUID avatar)
        {
            if (m_scene.Permissions.IsAdministrator(avatar))
                return false;

            if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0)
            {
                ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
                entry.AgentID = avatar;
                entry.Flags = AccessList.Ban;
                entry = LandData.ParcelAccessList.Find(delegate(ParcelManager.ParcelAccessEntry pae)
                {
                    if (entry.AgentID == pae.AgentID && entry.Flags == pae.Flags)
                        return true;
                    return false;
                });

                //See if they are on the list, but make sure the owner isn't banned
                if (entry.AgentID == avatar && LandData.OwnerID != avatar)
                {
                    //They are banned, so lets send them a notice about this parcel
                    return true;
                }
            }
            return false;
        }
        /// <summary>
        ///   Rebuild the access list from the database
        /// </summary>
        /// <param name = "LandData"></param>
        private void BuildParcelAccessList(LandData LandData)
        {
            QueryFilter filter = new QueryFilter();
            filter.andFilters["ParcelID"] = LandData.GlobalID;
            List<string> Query = GD.Query(new string[3]{
                "AccessID",
                "Flags",
                "Time"
            }, "parcelaccess", filter, null, null, null);

            ParcelManager.ParcelAccessEntry entry;
            for (int i = 0; i < Query.Count; i += 3)
            {
                entry = new ParcelManager.ParcelAccessEntry();
                entry.AgentID = UUID.Parse(Query[i]);
                entry.Flags = (AccessList) Enum.Parse(typeof (AccessList), Query[i + 1]);
                entry.Time = new DateTime(long.Parse(Query[i + 2]));
                LandData.ParcelAccessList.Add(entry);
            }
        }
Exemplo n.º 29
0
        public void UpdateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client)
        {
            LandData newData = LandData.Copy();

            if (entries.Count == 1 && entries[0].AgentID == UUID.Zero)
            {
                entries.Clear();
            }

            List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>();
            foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList)
            {
                if (entry.Flags == (AccessList)flags)
                {
                    toRemove.Add(entry);
                }
            }

            foreach (ParcelManager.ParcelAccessEntry entry in toRemove)
            {
                newData.ParcelAccessList.Remove(entry);
            }
            foreach (ParcelManager.ParcelAccessEntry entry in entries)
            {
                ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry();
                temp.AgentID = entry.AgentID;
                temp.Time = DateTime.MaxValue; //Pointless? NO.
                temp.Flags = (AccessList)flags;

                if (!newData.ParcelAccessList.Contains(temp))
                {
                    newData.ParcelAccessList.Add(temp);
                }
            }

            m_parcelManagementModule.UpdateLandObject(LandData.LocalID, newData);
        }
Exemplo n.º 30
0
 /// <summary>
 ///     The client wants to buy a pass for a parcel
 /// </summary>
 /// <param name="client"></param>
 /// <param name="fromID"></param>
 /// <param name="parcelLocalId"></param>
 private void ClientOnParcelBuyPass(IClientAPI client, UUID fromID, int parcelLocalId)
 {
     IScenePresence agentSp = m_scene.GetScenePresence(client.AgentId);
     IParcelManagementModule parcelManagement = agentSp.Scene.RequestModuleInterface<IParcelManagementModule>();
     ILandObject landParcel = null;
     List<ILandObject> land = parcelManagement.AllParcels();
     foreach (ILandObject landObject in land)
     {
         if (landObject.LandData.LocalID == parcelLocalId)
         {
             landParcel = landObject;
         }
     }
     if (landParcel != null)
     {
         bool giveResult = m_connector.UserCurrencyTransfer(landParcel.LandData.OwnerID, fromID, UUID.Zero,
                                                            UUID.Zero,
                                                            (uint) landParcel.LandData.PassPrice, "Parcel Pass",
                                                            TransactionType.LandPassFee, UUID.Random());
         if (giveResult)
         {
             ParcelManager.ParcelAccessEntry entry
                 = new ParcelManager.ParcelAccessEntry
                       {
                           AgentID = fromID,
                           Flags = AccessList.Access,
                           Time = DateTime.Now.AddHours(landParcel.LandData.PassHours)
                       };
             landParcel.LandData.ParcelAccessList.Add(entry);
             agentSp.ControllingClient.SendAgentAlertMessage("You have been added to the parcel access list.",
                                                             false);
         }
     }
     else
     {
         agentSp.ControllingClient.SendAgentAlertMessage("Unable to find parcel.", false);
     }
 }