本文整理汇总了PHP中Acl::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Acl::find方法的具体用法?PHP Acl::find怎么用?PHP Acl::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Acl
的用法示例。
在下文中一共展示了Acl::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateACLAction
public function updateACLAction()
{
if ($this->request->isPost()) {
$object = $this->getInstance(@$_POST["idRole"]);
if (@$_POST["idRole"]) {
try {
$acls = Acl::find("idRole=" . @$_POST["idRole"]);
foreach ($acls as $a) {
$a->delete();
}
$this->saveAcls($_POST['acl'], @$_POST["idRole"]);
$msg = new DisplayedMessage("Droits de `{$object}` mis à jour");
} catch (\Exception $e) {
$msg = new DisplayedMessage("Impossible de mettre à jour les droits de `{$object}`", "danger");
}
} else {
try {
$object->save();
$this->saveAcls($_POST['acl'], @$_POST["idRole"]);
$msg = new DisplayedMessage("Instance de " . $this->model . " `{$object}` ajoutée");
} catch (\Exception $e) {
$msg = new DisplayedMessage("Impossible d'ajouter l'instance de " . $this->model, "danger");
}
}
$this->dispatcher->forward(array("controller" => $this->dispatcher->getControllerName(), "action" => "index", "params" => array($msg)));
}
}
示例2: fastConnectAction
public function fastConnectAction($role)
{
$user = User::findFirst("idRole = " . $role);
if ($user != null) {
$this->session->set("user", $user);
$acl = Acl::find("idRole = " . $user->getIdRole());
$this->session->set("rights", AclController::toArray($acl));
$msg = new DisplayedMessage("Bienvenue " . $user);
$this->dispatcher->forward(array("controller" => "Index", "action" => "indexAjax", "params" => array($msg)));
} else {
$this->dispatcher->forward(array("controller" => "Auth", "action" => "signin", "params" => array(true)));
}
}