Various Attribute Flags for various users (different privileges): Difference between revisions
Appearance
New page: {{Howto|Advanced|eternalko <eternalko@gmail.com>}} == Summary == WIth this trick you can specify different flags to different users. For example users with admin (or manager) rights can F... |
|||
| Line 11: | Line 11: | ||
{ | { | ||
public function meta($policy) | |||
{ | { | ||
if($this->hasAdminRights()) | if($this->hasAdminRights()) | ||
Revision as of 20:51, 12 July 2008
|
ATK Howto: Various Attribute Flags for various users (different privileges)
|
Summary
WIth this trick you can specify different flags to different users. For example users with admin (or manager) rights can FULLY do what they want w ith some attribute (like an estimated profit from one pizza) and others (cooks) dont give a clue, that such a thing exists.
class pizza extends atkMetaNode
{
public function meta($policy)
{
if($this->hasAdminRights())
$flags=AF_HIDE_LIST;
else
$flags=AF_OBLIGATORY;
$policy->addFlags("pizza_estim_profit", $flags);
}
function hasAdminRights()
{
$securityManager = &atkGetSecurityManager();
return $securityManager->allowed("pizza_module.pizza", "admin");
}
}