method _user_has_permission documentation in bbn\Appui\Notification
function($notification, string $id_user = NULL)
{
if (!\is_array($notification)
&& \is_string($notification)
&& bbn\Str::isUid($notification)
) {
$notification = $this->get($notification);
}
if (\is_array($notification)
&& ($id_user = $id_user ?: ($notification[$this->fields['id_user']] ?? $this->user->getId()))
&& bbn\Str::isUid($id_user)
&& ($ucfg = $this->user->getClassCfg())
&& ($pcfg = $this->pref->getClassCfg())
&& ($user = $this->db->select(
$ucfg['table'], [
$ucfg['arch']['users']['id_group'],
$ucfg['arch']['users']['admin'],
$ucfg['arch']['users']['dev']
], [$ucfg['arch']['users']['id'] => $id_user]
))
) {
$id_opt = $notification[$this->class_cfg['arch']['content']['id_option']] ?? null;
if (!empty($user->{$ucfg['arch']['users']['admin']})
|| !empty($user->{$ucfg['arch']['users']['dev']})
|| empty($id_opt)
) {
return true;
}
if (($id_perm = $this->perms->optionToPermission($id_opt))) {
$parch = $pcfg['arch']['user_options'];
return (bool)$this->db->selectOne([
'table' => $pcfg['table'],
'fields' => ['id'],
'where' => [
'conditions' => [[
'field' => $parch['id_option'],
'value' => $id_perm
], [
'logic' => 'OR',
'conditions' => [[
'field' => $parch['public'],
'value' => 1
], [
'field' => $parch['id_user'],
'value' => $id_user
], [
'field' => $parch['id_group'],
'value' => $user->{$ucfg['arch']['users']['id_group']}
]]
]]
]
]);
}
}
return false;
}
BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2023
BBN Solutions