示例#1
0
 /**
  * Test Node()
  *
  * @return void
  */
 public function testNode()
 {
     $Person = TableRegistry::get('AclPeople');
     $this->Aro->save(new Aro(['model' => $Person->alias(), 'foreign_key' => 2, 'parent_id' => null]));
     $person = new AclPerson(['id' => 2], ['source' => $Person->alias()]);
     $result = $Person->node($person, 'Aro');
     $this->assertEquals(1, $result->count());
 }
示例#2
0
 /**
  * Get allowed cache key.
  *
  * @param Query $actions
  * @param Aro $aro
  * @return string
  */
 protected function _getAllowedCacheKey(Query $actions, Aro $aro)
 {
     $key = implode('_', ['allowed_role-' . $aro->get('id'), 'user-' . $this->_user->get('id', Role::PUBLIC_ID), 'acos-' . implode('-', array_keys($actions->toArray()))]);
     if (!Configure::read('debug')) {
         return md5($key);
     }
     return $key;
 }