Пример #1
0
        /// <summary>
        /// Checks the permission.
        /// </summary>
        /// <param name="recordIdentification">The record identification.</param>
        /// <param name="alwaysRemote">if set to <c>true</c> [always remote].</param>
        /// <param name="theDelegate">The delegate.</param>
        /// <returns></returns>
        public Operation CheckPermission(string recordIdentification, bool alwaysRemote, UPRightsCheckerDelegate theDelegate)
        {
            if (!alwaysRemote &&
                UPCRMDataStore.DefaultStore.RecordExistsOffline(recordIdentification))
            {
                var hasPermission = this.CheckLocalPermission(recordIdentification);
                if (hasPermission)
                {
                    theDelegate?.RightsCheckerGrantsPermission(this, recordIdentification);
                }
                else
                {
                    theDelegate?.RightsCheckerRevokePermission(this, recordIdentification);
                }

                return(null);
            }

            var crmQuery = this.CrmQueryForRecordIdentification(recordIdentification);
            var request  = new UPRightsCheckerRequest(recordIdentification, crmQuery, theDelegate, this);

            if (this.requests == null)
            {
                this.requests = new List <UPRightsCheckerRequest> {
                    request
                };
            }
            else
            {
                this.requests.Add(request);
            }

            return(request.Start());
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UPRightsCheckerRequest"/> class.
 /// </summary>
 /// <param name="recordIdentification">The record identification.</param>
 /// <param name="crmQuery">The CRM query.</param>
 /// <param name="theDelegate">The delegate.</param>
 /// <param name="rightsChecker">The rights checker.</param>
 public UPRightsCheckerRequest(string recordIdentification, UPContainerMetaInfo crmQuery, UPRightsCheckerDelegate theDelegate, UPRightsChecker rightsChecker)
 {
     this.RecordIdentification = recordIdentification;
     this.Delegate             = theDelegate;
     this.RightsChecker        = rightsChecker;
     this.CrmQuery             = crmQuery;
 }