Profile::getRightsFor PHP Method

getRightsFor() static public method

Get rights for an itemtype
static public getRightsFor ( $itemtype, $interface = 'central' ) : rights
$itemtype string itemtype
$interface string (default 'central')
return rights
    static function getRightsFor($itemtype, $interface = 'central')
    {
        if (class_exists($itemtype)) {
            $item = new $itemtype();
            return $item->getRights($interface);
        }
    }

Usage Example

 public static function createFirstAccess($ID)
 {
     $talk_profile = new self();
     $profile = new Profile();
     $dataprofile = array('id' => $ID);
     $profile->getFromDB($ID);
     foreach ($talk_profile->getAllRights(true) as $talk_r) {
         $g_rights = $profile->getRightsFor($talk_r['itemtype']);
         foreach ($g_rights as $g_right => $label) {
             $dataprofile['_' . $talk_r['field']][$g_right . "_0"] = 1;
         }
     }
     $profile->update($dataprofile);
 }
All Usage Examples Of Profile::getRightsFor