Example #1
0
 protected function addToIndex($key, $expires = null)
 {
     if ($this->indexing) {
         $this->store->sAdd("{$this->prefix}::index", $key);
     }
     return parent::addToIndex($key, $expires);
 }
Example #2
0
 /**
  * @param $roleName
  * @param $resourceName
  * @param $accessName
  * @param $action
  * @return bool
  * @throws Exception
  */
 protected function setAccess($roleName, $resourceName, $accessName, $action)
 {
     /**
      * Check if the access is valid in the resource
      */
     if ($this->isResourceAccess($resourceName, $accessName)) {
         if (!$this->setNXAccess) {
             throw new Exception("Access '" . $accessName . "' does not exist in resource '" . $resourceName . "' in ACL");
         }
         $this->addResourceAccess($resourceName, $accessName);
     }
     $this->redis->sAdd("accessList:{$roleName}:{$resourceName}:{$action}", $accessName);
     $accessList = "accessList:{$roleName}:{$resourceName}";
     // remove first if exists
     foreach (array(1, 2) as $act) {
         $this->redis->sRem("{$accessList}:{$act}", $accessName);
         $this->redis->sRem("{$accessList}:{$act}", "*");
     }
     $this->redis->sAdd("{$accessList}:{$action}", $accessName);
     $this->redis->sAdd("{$accessList}:{$this->getDefaultAction()}", "*");
     return true;
 }
Example #3
0
 /**
  * Adds a values to the set value stored at key.
  * If this value is already in the set, FALSE is returned.
  *
  * @param $key
  * @param $value
  * @return boolean
  */
 public function addItemList($key, $value)
 {
     return $this->client->sAdd($key, $value);
 }