Example #1
0
 /**
  * Check permissions for this area
  *
  * Override this function if you want to customize the permissions for an area. BUT preferably use the DB...
  */
 public function checkPermissions(array $options = array())
 {
     $action = !empty($options['action']) ? $options['action'] : (!empty(Controller::$action) ? Controller::check_reverse_map('action', Controller::$action) : '*');
     $subject = !empty($options['subject']) ? $options['subject'] : (!empty(Controller::$area) ? Controller::check_reverse_map('area', Controller::$area) : '*');
     if (count(Controller::$parameters) === 1) {
         $subject_id = !empty($options['subject_id']) ? $options['subject_id'] : (!empty(Controller::$parameters[0]) ? Controller::check_reverse_map('id', Controller::$parameters[0]) : 0);
     } else {
         $subject_id = 0;
     }
     if (ConfigValue::get('AdminInstalled', false)) {
         return Permission::check($action, $subject, $subject_id);
     } else {
         if (!($subject == 'admin' && in_array($action, array('pre_install', 'check_install', 'install')))) {
             return false;
         }
     }
     return true;
 }