示例#1
0
        /// <summary>
        /// Checks whether the user has permission to export an inventory item to an IAR.
        /// </summary>
        /// <param name="UserID">The user</param>
        /// <param name="InvItem">The inventory item</param>
        /// <returns>Whether the user is allowed to export the object to an IAR</returns>
        private bool CanUserArchiveObject(UUID UserID, InventoryItemBase InvItem)
        {
            if (FilterContent == null)
            {
                return(true);// Default To Allow Export
            }
            bool permitted = true;

            bool canCopy     = (InvItem.CurrentPermissions & (uint)PermissionMask.Copy) != 0;
            bool canTransfer = (InvItem.CurrentPermissions & (uint)PermissionMask.Transfer) != 0;
            bool canMod      = (InvItem.CurrentPermissions & (uint)PermissionMask.Modify) != 0;

            if (FilterContent.Contains("C") && !canCopy)
            {
                permitted = false;
            }

            if (FilterContent.Contains("T") && !canTransfer)
            {
                permitted = false;
            }

            if (FilterContent.Contains("M") && !canMod)
            {
                permitted = false;
            }

            return(permitted);
        }
            public void AddsToCriteriaFilter(string value)
            {
                var field    = ContentProperty.Path;
                var criteria = new ContentCriteria();
                var sut      = new FilterContent(criteria, field);

                sut.Contains(value);

                Assert.AreEqual(1, criteria.FilterGroups.Count);
                Assert.AreEqual(field, criteria.FilterGroups[0].Filters[0].Field);
                Assert.AreEqual(value, criteria.FilterGroups[0].Filters[0].Value);
            }