Beispiel #1
0
 protected override AccessResult GetItemAccess(Sitecore.Data.Items.Item item, Account account, AccessRight accessRight, PropagationType propagationType)
 {
     //
     //This method applies the specified AccessRight.  Since the custom AccessRight
     //has been extended to support additional properties (max comments and
     //time range), these properties must be considered.
     var result = base.GetItemAccess(item, account, accessRight, propagationType);
     //
     //
     if (result == null || result.Permission != AccessPermission.Allow)
     {
         return result;
     }
     //
     //
     if (accessRight.Name != BucketRights.AddComments)
     {
         return result;
     }
     //
     //
     var right = accessRight as BucketAccessRight;
     if (right != null)
     {
         result = GetItemAccess(item, account, right);
     }
     return result;
 }
        /// <summary>
        /// Sometimes a part's situation may change in a way that affects master-slave chains. Examples
        /// of this include attaching a part (with its tree of children); detaching a part (with its
        /// tree of children); user manually toggling slave mode on/off; altering ship in flight
        /// (e.g. docking, undocking, part destruction).  Whenever that happens, something that
        /// affects *this* part's choice of master can affect its entire child tree, too, so we need
        /// to propagate the change.
        ///
        /// This function affects the part passed in, as well as all of its children. It will be called
        /// on all parts, not just robotic parts are those equipped with ModuleRoboticSlave, since
        /// the master-slave connection propagates through "neutral" parts such as structural elements.
        /// </summary>
        /// <param name="part">The part to which to propagate a master</param>
        /// <param name="prospectiveMaster">The relevant actual or potential master. Null if no master candidate is available.</param>
        private static void PropagateMaster(Part part, ModuleRoboticServoHinge prospectiveMaster)
        {
            // Figure out how we propagate
            ModuleRoboticServoHinge localServo;
            ModuleRoboticSlave      slave;
            PropagationType         propagation = PropagationTypeOf(part, out localServo, out slave);
            ModuleRoboticServoHinge toPropagate = null;

            switch (propagation)
            {
            case PropagationType.Transparent:
                toPropagate = prospectiveMaster;
                break;

            case PropagationType.Assertive:
                toPropagate = localServo;
                break;
            }

            // If this part is a slaveable one, set the master.
            if (slave != null)
            {
                slave.Master = prospectiveMaster;
            }

            // Propagate to children.
            if (part.children != null)
            {
                for (int i = 0; i < part.children.Count; ++i)
                {
                    PropagateMaster(part.children[i], toPropagate);
                }
            }
        }
Beispiel #3
0
        protected override AccessResult GetItemAccess(Item item, Account account, AccessRight accessRight,
                                                      PropagationType propagationType)
        {
            var result = base.GetItemAccess(item, account, accessRight, propagationType);

            // We don't want to overrule other permissions not allowing access (write access etc.)
            if (result?.Permission != AccessPermission.Allow)
            {
                return(result);
            }

            // Only check if the item is the "CanDesign" policy item or if context item is not null
            // Context item can be null for some requests in the Content Editor
            if (!ShouldCheckDesignRights(item))
            {
                return(result);
            }

            var designAccessResult = DesignAccessRight.GetAccess(Context.Item, account);

            if (designAccessResult.Permission != AccessPermission.Allow)
            {
                return(designAccessResult);
            }

            return(result);
        }
 // Methods
 protected override void AddAccessResultToCache(ISecurable entity, Account account, AccessRight accessRight, AccessResult accessResult, PropagationType propagationType)
 {
     if (accessRight.Name != "adoption:change")
     {
         base.AddAccessResultToCache(entity, account, accessRight, accessResult, propagationType);
     }
 }
        protected override void AddAccessResultToCache(ISecurable entity, Account account, AccessRight accessRight, AccessResult accessResult, PropagationType propagationType)
        {
            if (accessRight.Name == BucketRights.MakeABucket)
            {
                return;
            }

            base.AddAccessResultToCache(entity, account, accessRight, accessResult, propagationType);
        }
 protected override void AddAccessResultToCache(ISecurable entity, Account account, AccessRight accessRight, AccessResult accessResult, PropagationType propagationType)
 {
     //
     //Do not cache the access result because the result depends
     //on the value that is currently set on the item.
     if (accessRight.Name == BucketRights.AddComments)
     {
         return;
     }
     base.AddAccessResultToCache(entity, account, accessRight, accessResult, propagationType);
 }
Beispiel #7
0
        public async Task <IActionResult> ChangePropagationType(Guid id, PropagationType type)
        {
            var command = new ChangeEventSendTypeCommand {
                Id = id, Type = type
            };

            if (await Mediator.Send(command) == null)
            {
                return(BadRequest());
            }

            return(Ok());
        }
        protected override AccessResult GetItemAccess(Data.Items.Item item, Account account, AccessRight accessRight, PropagationType propagationType)
        {
            var result = base.GetItemAccess(item, account, accessRight, propagationType);
            if (result.IsNull() || result.Permission != AccessPermission.Allow)
            {
                return result;
            }

            if (accessRight.Name != BucketRights.MakeABucket)
            {
                return result;
            }

            var right = accessRight as BucketAccessRight;
            if (right.IsNotNull())
            {
                result = this.GetItemAccess(item, account, right);
            }

            return result;
        }
        protected override AccessResult GetItemAccess(Data.Items.Item item, Account account, AccessRight accessRight, PropagationType propagationType)
        {
            var result = base.GetItemAccess(item, account, accessRight, propagationType);

            if (result.IsNull() || result.Permission != AccessPermission.Allow)
            {
                return(result);
            }

            if (accessRight.Name != BucketRights.MakeABucket)
            {
                return(result);
            }

            var right = accessRight as BucketAccessRight;

            if (right.IsNotNull())
            {
                result = this.GetItemAccess(item, account, right);
            }

            return(result);
        }
        protected override void AddAccessResultToCache(ISecurable entity, Account account, AccessRight accessRight, AccessResult accessResult, PropagationType propagationType)
        {
            if (accessRight.Name == BucketRights.MakeABucket)
            {
                return;
            }

            base.AddAccessResultToCache(entity, account, accessRight, accessResult, propagationType);
        }
 protected override void AddAccessResultToCache(ISecurable entity, Account account, AccessRight accessRight, AccessResult accessResult, PropagationType propagationType)
 {
     // base.AddAccessResultToCache(entity, account, accessRight, accessResult, propagationType);
 }
Beispiel #12
0
 /// <remarks/>
 public void SetRightAsync(string strDatabase, string strItem, string strAccount, string strRights, AccessPermission rightState, PropagationType propagationType, Credentials credentials, object userState) {
     if ((this.SetRightOperationCompleted == null)) {
         this.SetRightOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetRightOperationCompleted);
     }
     this.InvokeAsync("SetRight", new object[] {
                 strDatabase,
                 strItem,
                 strAccount,
                 strRights,
                 rightState,
                 propagationType,
                 credentials}, this.SetRightOperationCompleted, userState);
 }
        protected override AccessResult GetItemAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
        {
            AccessResult oItemAccessResult;

            oItemAccessResult = CheckAccess(item, accessRight);

            return(oItemAccessResult);
        }
Beispiel #14
0
 /// <remarks/>
 public void SetRightAsync(string strDatabase, string strItem, string strAccount, string strRights, AccessPermission rightState, PropagationType propagationType, Credentials credentials) {
     this.SetRightAsync(strDatabase, strItem, strAccount, strRights, rightState, propagationType, credentials, null);
 }
Beispiel #15
0
 public void SetRight(string strDatabase, string strItem, string strAccount, string strRights, AccessPermission rightState, PropagationType propagationType, Credentials credentials) {
     this.Invoke("SetRight", new object[] {
                 strDatabase,
                 strItem,
                 strAccount,
                 strRights,
                 rightState,
                 propagationType,
                 credentials});
 }
Beispiel #16
0
 public void SetRight(string strDatabase, string strItem, string strAccount, string strRights, AccessPermission rightState, PropagationType propagationType, Credentials credentials)
 {
     this.Invoke("SetRight", new object[] {
         strDatabase,
         strItem,
         strAccount,
         strRights,
         rightState,
         propagationType,
         credentials
     });
 }
Beispiel #17
0
 /// <remarks/>
 public void SetRightAsync(string strDatabase, string strItem, string strAccount, string strRights, AccessPermission rightState, PropagationType propagationType, Credentials credentials, object userState)
 {
     if ((this.SetRightOperationCompleted == null))
     {
         this.SetRightOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetRightOperationCompleted);
     }
     this.InvokeAsync("SetRight", new object[] {
         strDatabase,
         strItem,
         strAccount,
         strRights,
         rightState,
         propagationType,
         credentials
     }, this.SetRightOperationCompleted, userState);
 }
Beispiel #18
0
 /// <remarks/>
 public void SetRightAsync(string strDatabase, string strItem, string strAccount, string strRights, AccessPermission rightState, PropagationType propagationType, Credentials credentials)
 {
     this.SetRightAsync(strDatabase, strItem, strAccount, strRights, rightState, propagationType, credentials, null);
 }