/** * @test **/ public function it_prepare_sentry_permission() { $data = ["permissions" => "permission1"]; $operation = 1; $helper = new FormHelper(); $helper->prepareSentryPermissionInput($data, $operation); $this->assertEquals(["permission1" => 1], $data["permissions"]); }
public function editPermission() { // prepare input $input = Input::all(); $operation = Input::get('operation'); $this->form_model->prepareSentryPermissionInput($input, $operation); $id = Input::get('id'); try { $obj = $this->group_repository->update($id, $input); } catch (JacopoExceptionsInterface $e) { return Redirect::route("users.groups.edit")->withInput()->withErrors(new MessageBag(["permissions" => Config::get('laravel-authentication-acl::messages.flash.error.group_permission_not_found')])); } return Redirect::action('Jacopo\\Authentication\\Controllers\\GroupController@editGroup', ["id" => $obj->id])->withMessage(Config::get('laravel-authentication-acl::messages.flash.success.group_permission_edit_success')); }
public function editPermission() { // prepare input $input = Input::all(); $operation = Input::get('operation'); $this->form_model->prepareSentryPermissionInput($input, $operation); $id = Input::get('id'); try { $obj = $this->group_repository->update($id, $input); } catch (JacopoExceptionsInterface $e) { return Redirect::route("users.groups.edit")->withInput()->withErrors(new MessageBag(["permissions" => "Permesso non trovato"])); } return Redirect::action('Jacopo\\Authentication\\Controllers\\GroupController@editGroup', ["id" => $obj->id])->withMessage("Permesso modificato con successo."); }
public function editPermission() { // prepare input $input = Input::all(); $operation = Input::get('operation'); $this->form_helper->prepareSentryPermissionInput($input, $operation); $id = Input::get('id'); try { $obj = $this->user_repository->update($id, $input); } catch (JacopoExceptionsInterface $e) { return Redirect::route("users.edit")->withInput()->withErrors(new MessageBag(["permissions" => "Permission not found"])); } return Redirect::action('Jacopo\\Authentication\\Controllers\\UserController@editUser', ["id" => $obj->id])->withMessage("Permission edited with success."); }
<?php use Jacopo\Authentication\Helpers\FormHelper; /** * permission select */ View::composer(['laravel-authentication-acl::admin.user.edit', 'laravel-authentication-acl::admin.group.edit'], function ($view) { $fh = new FormHelper(); $values_permission = $fh->getSelectValuesPermission(); $view->with('permission_values', $values_permission); }); /** * group select */ View::composer(['laravel-authentication-acl::admin.user.edit', 'laravel-authentication-acl::admin.group.edit', 'laravel-authentication-acl::admin.user.search'], function ($view) { $fh = new FormHelper(); $values_group = $fh->getSelectValuesGroups(); $view->with('group_values', $values_group); });