本文整理汇总了PHP中QubitAcl::getRepositoryAccess方法的典型用法代码示例。如果您正苦于以下问题:PHP QubitAcl::getRepositoryAccess方法的具体用法?PHP QubitAcl::getRepositoryAccess怎么用?PHP QubitAcl::getRepositoryAccess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QubitAcl
的用法示例。
在下文中一共展示了QubitAcl::getRepositoryAccess方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute($request)
{
$criteria = new Criteria();
$criteria->addJoin(QubitActor::ID, QubitActorI18n::ID);
$criteria->add(QubitActorI18n::AUTHORIZED_FORM_OF_NAME, "{$request->query}%", Criteria::LIKE);
$criteria->addAscendingOrderByColumn('authorized_form_of_name');
$criteria->setDistinct();
$criteria->setLimit(sfConfig::get('app_hits_per_page', 10));
$criteria = QubitCultureFallback::addFallbackCriteria($criteria, 'QubitActor');
// Filter "denied" repositories if list for repository autocomplete on
// information object form
if (isset($request->aclAction)) {
$repositoryList = array();
$repositoryAccess = QubitAcl::getRepositoryAccess($request->aclAction);
// If all repositories are denied, no response
if (1 == count($repositoryAccess) && QubitAcl::DENY == $repositoryAccess[0]['access']) {
return sfView::NONE;
} else {
while ($repo = array_shift($repositoryAccess)) {
if ('*' != $repo['id']) {
$repositoryList[] = $repo['id'];
} else {
if (QubitAcl::DENY == $repo['access']) {
// Require repositories to be specifically allowed (all others
// prohibited)
$criteria->add(QubitRepository::ID, $repositoryList + array('null'), Criteria::IN);
} else {
// Prohibit specified repositories (all others allowed)
$criteria->add(QubitRepository::ID, $repositoryList, Criteria::NOT_IN);
}
}
}
}
}
$this->repositories = QubitRepository::get($criteria);
}
示例2: searchFilterDrafts
public static function searchFilterDrafts($query)
{
// Filter out 'draft' items by repository
$repositoryViewDrafts = QubitAcl::getRepositoryAccess('viewDraft');
if (1 == count($repositoryViewDrafts)) {
if (QubitAcl::DENY == $repositoryViewDrafts[0]['access']) {
// Don't show *any* draft info objects
$query->addSubquery(QubitSearch::getInstance()->addTerm(QubitTerm::PUBLICATION_STATUS_PUBLISHED_ID, 'publicationStatusId'), true);
}
} else {
// Get last rule in list, it will be the global rule with the opposite
// access of the preceeding rules (e.g. if last rule is "DENY ALL" then
// preceeding rules will be "ALLOW" rules)
$globalRule = array_pop($repositoryViewDrafts);
// If global rule is GRANT, then listed repos are exceptions so remove
// from results
if (QubitAcl::GRANT == $globalRule['access']) {
while ($repo = array_shift($repositoryViewDrafts)) {
$query->addSubquery(QubitSearch::getInstance()->addTerm($repo['id'], 'repositoryId'), true);
$query->addSubquery(QubitSearch::getInstance()->addTerm(QubitTerm::PUBLICATION_STATUS_DRAFT_ID, 'publicationStatusId'), true);
}
} else {
while ($repo = array_shift($repositoryViewDrafts)) {
$query->addSubquery(QubitSearch::getInstance()->addTerm($repo['id'], 'repositoryId'), true);
}
// Filter rule should look like "+(id:(356 357 358) status:published)"
$query->addSubquery(QubitSearch::getInstance()->addTerm(QubitTerm::PUBLICATION_STATUS_PUBLISHED_ID, 'publicationStatusId'), true);
}
}
return $query;
}