コード例 #1
0
ファイル: ItemRoles.cs プロジェクト: ssrisunt/dynamite
        public ItemRoles(SPWeb web, IItemLocator itemLocator, string listLocation, string itemName, IEnumerable <GroupRolePair> groupRolePairs, bool shouldCopyParentRolesWhenBreakingInheritance = true)
            : base(shouldCopyParentRolesWhenBreakingInheritance)
        {
            this.Web = web;
            this.SecurableObjectLocation = listLocation;
            this.itemName = itemName;

            this.itemLocator = itemLocator;

            this.GroupRolePairs.Clear();
            this.GroupRolePairs.AddRange(groupRolePairs);
        }
コード例 #2
0
ファイル: ItemRoles.cs プロジェクト: andresglx/Dynamite
        public ItemRoles(SPWeb web, IItemLocator itemLocator, string listLocation, string itemName, IEnumerable<GroupRolePair> groupRolePairs, bool shouldCopyParentRolesWhenBreakingInheritance = true)
            : base(shouldCopyParentRolesWhenBreakingInheritance)
        {
            this.Web = web;
            this.SecurableObjectLocation = listLocation;
            this.itemName = itemName;

            this.itemLocator = itemLocator;

            this.GroupRolePairs.Clear();
            this.GroupRolePairs.AddRange(groupRolePairs);
        }
コード例 #3
0
        private IEnumerable <FilterInstruction> GetFilterInstructions(RestItemData itemData)
        {
            foreach (string fieldName in itemData.Keys)
            {
                IItemLocator <TNav> locator = _subContext.Fields.GetLocator(fieldName);
                if (locator == null)
                {
                    continue;
                }

                string findValue = itemData[fieldName].ToString(); // todo currently converts from int only to be parsed back later
                yield return(new FilterInstruction(fieldName, FilterComparisonOperator.Equals, findValue));
            }
        }
コード例 #4
0
        /// <summary>
        /// Attempts to locate the item to modify using the modification request data.
        /// </summary>
        internal DeferredItemBase <TNav> LocateItem(IEngineRepository <TNav> navRepository, RestItemData itemData)
        {
            foreach (string fieldName in itemData.Keys)
            {
                // TODO implicit & explicit location option e.g. { "*id": 123 }

                IItemLocator <TNav> locator = _subContext.Fields.GetLocator(fieldName);
                if (locator != null)
                {
                    object findValue = itemData[fieldName];

                    TNav locatedItem = locator.TryLocateItem(navRepository, findValue);
                    if (locatedItem != null)
                    {
                        itemData.Remove(fieldName); // remove so we don't write to this value later.
                        return(new LoadedItem <TNav>(locatedItem));
                    }
                }
            }

            return(null);
        }