Various Attribute Flags for various users (different privileges)

From Achievo/ATK Wiki

Jump to: navigation, search

ATK Howto: Various Attribute Flags for various users (different privileges)

Complexity: Basic
Author: eternalko <eternalko@gmail.com>

List of other Howto's

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");
	}
	
  }
Personal tools
Navigation