本文整理汇总了PHP中ACL::get_granted_sbas方法的典型用法代码示例。如果您正苦于以下问题:PHP ACL::get_granted_sbas方法的具体用法?PHP ACL::get_granted_sbas怎么用?PHP ACL::get_granted_sbas使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACL
的用法示例。
在下文中一共展示了ACL::get_granted_sbas方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGet_granted_sbas
public function testGet_granted_sbas()
{
$sbas_ids = [];
$n = 0;
foreach (self::$DI['app']['phraseanet.appbox']->get_databoxes() as $databox) {
$sbas_ids[] = $databox->get_sbas_id();
$n++;
}
self::$object->give_access_to_sbas($sbas_ids);
$sbas = self::$object->get_granted_sbas();
$this->assertEquals(count($sbas), count($sbas_ids));
$this->assertEquals($n, count($sbas_ids));
foreach ($sbas as $sbas_id => $databox) {
try {
$this->assertTrue($databox instanceof databox);
$this->assertEquals($sbas_id, $databox->get_sbas_id());
unset($databox);
} catch (Exception $e) {
$this->fail('get granted sbas should returned OK collection');
}
}
}
示例2: on_sbas_where_i_am
/**
* Restrict users on database with provided rights
*
* @param ACL $ACL
* @param array $rights
*
* @return $this
*/
public function on_sbas_where_i_am(ACL $ACL, array $rights)
{
$this->sbas_restrictions = true;
$databoxes = array_keys($ACL->get_granted_sbas($rights));
if (count($this->sbas_ids) > 0) {
$this->sbas_ids = array_intersect($this->sbas_ids, $databoxes);
} else {
$this->sbas_ids = $databoxes;
}
$this->total = $this->page = $this->total_page = null;
return $this;
}