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... |
|||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{Howto| | {{Howto|Basic|eternalko <eternalko@gmail.com>}} | ||
== Summary == | == Summary == | ||
| Line 11: | Line 11: | ||
{ | { | ||
public function meta($policy) | |||
{ | { | ||
if($this->hasAdminRights()) | if($this->hasAdminRights()) | ||
$flags=AF_OBLIGATORY; | |||
else | |||
$flags=AF_HIDE_LIST; | $flags=AF_HIDE_LIST; | ||
$policy->addFlags("pizza_estim_profit", $flags); | $policy->addFlags("pizza_estim_profit", $flags); | ||
Latest revision as of 20:52, 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_OBLIGATORY;
else
$flags=AF_HIDE_LIST;
$policy->addFlags("pizza_estim_profit", $flags);
}
function hasAdminRights()
{
$securityManager = &atkGetSecurityManager();
return $securityManager->allowed("pizza_module.pizza", "admin");
}
}