public function action_check() { $roles = GateKeeper::getRoles(); if (!$roles || !count($roles)) { if (Controller::$debug) { Backend::addNotice('No roles setup, addings some'); } $roles = $this->getDefaultRoles(); if ($roles) { foreach ($roles as $role) { GateKeeper::assign($role['role'], $role['access_type'], $role['access_id']); if (Controller::$debug) { Backend::addSuccess('Added role ' . $role['role']); } } } $permits = $this->getDefaultPermissions(); if ($permits) { foreach ($permits as $permit) { GateKeeper::permit($permit['role'], $permit['control'], $permit['action'], $permit['subject'], $permit['subject_id']); if (Controller::$debug) { Backend::addSuccess('Added permission to ' . $role['action'] . ' to ' . $permit['role']); } } } } else { if (Controller::$debug) { var_dump($roles); } } }