/** * Attach access policy events. * * @param \Illuminate\Contracts\Foundation\Application $app * * @return void */ protected function attachAccessPolicyEvents(Application $app) { // Orchestra Platform should be able to watch any changes to Role model // and sync the information to "orchestra.acl". Role::observe($app->make(RoleObserver::class)); // Orchestra Platform should be able to determine admin and member roles // dynamically. Role::setDefaultRoles($app->make('config')->get('orchestra/foundation::roles')); }
/** * Handle `orchestra.saved: extension.orchestra/control` event. * * @param \Illuminate\Support\Fluent $input * * @return void */ public function handle(Fluent $input) { $localtime = $input['localtime'] === 'yes'; $this->config->set('orchestra/foundation::roles.admin', (int) $input['admin_role']); $this->config->set('orchestra/foundation::roles.member', (int) $input['member_role']); Role::setDefaultRoles($this->config->get('orchestra/foundation::roles')); $this->synchronizer->handle(); $this->memory->put('extension_orchestra/control.localtime', $localtime); }