Esempio n. 1
0
        public bool HasWriteAccessForCustomer(int CustomerID)
        {
            // Always return true if we are working with offline/local file envrionment
            if (this.OfflineAndLocalFilesOnly == true)
            {
                return(true);
            }

            RBACCustomerInfoPredicate customerPredicate = new RBACCustomerInfoPredicate(CustomerID);

            RBACToolbox.RBACCustomerInfo grantedCustomer = this.GrantedCustomers.Find(customerPredicate.CompareByCustomerID);
            if (grantedCustomer != null)
            {
                RBACItemInfo grantedItem = null;

                // User access to customer, so we will assume they have read/write access also.  However, if they have the
                // "ReadOnlyAccess" role, then we will return false

                RBACItemInfoPredicate rolePredicate = new RBACItemInfoPredicate("ReadOnlyAccess", RBACItemType.Role);
                grantedItem = this.GrantedItems.Find(rolePredicate.CompareByNameAndItemType);
                if (grantedItem != null)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                // User doesn't have access to customer at all (not even to read)
                return(false);
            }
        }
Esempio n. 2
0
        public bool HasGrantedItem(string itemName)
        {
            RBACItemInfo          grantedItem   = null;
            RBACItemInfoPredicate rolePredicate = new RBACItemInfoPredicate(itemName, RBACItemType.Role);

            grantedItem = this.GrantedItems.Find(rolePredicate.CompareByNameAndItemType);
            if (grantedItem != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }