Form View Generator for Orchestra\Model\User.

@param  \Orchestra\Model\User  $model

@return \Orchestra\Contracts\Html\Form\Builder
491803
public function form($model)
    {
        return $this->form->of('orchestra.users', function (FormGrid $form) use ($model) {
            $form->resource($this, 'orchestra/foundation::users', $model);

            $form->hidden('id');

            $form->fieldset(function (Fieldset $fieldset) {
                $fieldset->control('input:text', 'email')
                    ->label(trans('orchestra/foundation::label.users.email'));

                $fieldset->control('input:text', 'fullname')
                    ->label(trans('orchestra/foundation::label.users.fullname'));

                $fieldset->control('input:password', 'password')
                    ->label(trans('orchestra/foundation::label.users.password'));

                $fieldset->control('select', 'roles[]')
                    ->label(trans('orchestra/foundation::label.users.roles'))
                    ->attributes(['multiple' => true])
                    ->options(function () {
                        $roles = app('orchestra.role');

                        return $roles->pluck('name', 'id');
                    })
                    ->value(function ($user) {
                        // get all the user roles from objects
                        return $user->roles()->get()->pluck('id')->all();
                    });
            });
        });
    }
244845
protected function bindUserModel()
    {
        $this->app->bind(CanBeOwnerContract::class, function (ApplicationContract $app) {
            $config = $app->make('config');

            return $config->get('auth.providers.users.model', $config->get('auth.model'));
        });
    }
1373025
protected function renderedShowFieldStrategies(Model $model)
    {
        $views = [];

        foreach ($this->getModelInformation()->show->fields as $key => $data) {

            if ( ! $this->allowedToUseShowFieldData($data)) {
                continue;
            }

            try {
                $instance = $this->getShowFieldFactory()->make($data->strategy);

                // Feed any extra information we can gather to the instance
                $instance->setOptions($data->options());

                if ($data->source) {
                    if (isset($this->getModelInformation()->attributes[ $data->source ])) {
                        $instance->setAttributeInformation(
                            $this->getModelInformation()->attributes[ $data->source ]
                        );
                    }
                }

                // @codeCoverageIgnoreStart
            } catch (Exception $e) {
                $message = "Failed to make show field strategy for '{$key}': \n{$e->getMessage()}";

                throw new StrategyRenderException($message, $e->getCode(), $e);
                // @codeCoverageIgnoreEnd
            }

            try {
                $views[ $key ] = $instance->render($model, $data->source);

                // @codeCoverageIgnoreStart
            } catch (Exception $e) {
                $message = "Failed to render show field '{$key}' for strategy " . get_class($instance)
                         . ": \n{$e->getMessage()}";

                throw new StrategyRenderException($message, $e->getCode(), $e);
                // @codeCoverageIgnoreEnd
            }
        }

        return $views;
    }
888946
public function edit(User $user)
    {
        $roles = Role::all();
        $permissions = Permission::all();
        return view('chuckcms::backend.users.edit', compact('user', 'roles', 'permissions'));
    }
670763
public function formAction(Request $request, $userId)
    {
        $workflowRight = $this->get('open_orchestra_workflow_function_admin.manager.workflow_right')->loadOrGenerateByUser($userId);

        $url = $this->generateUrl('open_orchestra_backoffice_workflow_right_form', array('userId' => $userId));

        return $this->generateForm($request, $workflowRight, $url, WorkflowRightEvents::WORKFLOWRIGHT_UPDATE);
    }
258362
protected function getUserModel()
    {
        if ( null === $this->userModel )
        {
            $this->userModel = $this->getServiceLocator()
                                    ->get( 'Grid\User\Model\User\Model' );
        }

        return $this->userModel;
    }
537635
public function createAction(Request $request)
    {
        $user = $this->getParameter('opifer_cms.user_model');
        $user = new $user();

        $form = $this->createForm(UserFormType::class, $user);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $this->get('fos_user.user_manager')->updateUser($user, true);

            $this->addFlash('success', $this->get('translator')->trans('user.new.success', [
                '%username%' => ucfirst($user->getUsername()),
                '%id%' => $user->getId(),
            ]));

            return $this->redirectToRoute('opifer_cms_user_index');
        }

        return $this->render('OpiferCmsBundle:Backend/User:create.html.twig', [
            'form' => $form->createView(),
        ]);
    }
1090816
private function createCreateForm(UserGroup $entity)
    {
        $options = array ('action' => $this->generateUrl('admin_usergroup_create'),
                          'method' => 'POST'
                         );

        $form = $this->createForm(new UserGroupType(), $entity, $options);

        return $form;
    }
1249206
public function edit(User $user)
    {
        $user->permissions = $user->permissions()->pluck('name')->all();
        $user->roles = $user->roles()->pluck('id')->all();

        return view('users::admin.edit')
            ->with(['model' => $user]);
    }
318648
public function edit(User $user)
    {
        return $this->appShellView('user.edit', [
            'user'  => $user,
            'types' => UserTypeProxy::choices(),
            'roles' => RoleProxy::all()
        ]);
    }
1278781
public function render(Model $model, $source)
    {
        return view(static::VIEW, [
            'color' => $this->resolveModelSource($model, $source),
        ]);
    }
1236807
protected function checkPermission(User $user, $model, $action)
    {
        $dataType = Admin::model('DataType');
        $dataType = $dataType->where('model_name', get_class($model))->first();

        return $user->hasPermission($action.'_'.$dataType->slug);
    }
193777
protected function form(Fluent $model, FormBuilder $form)
    {
        $form->extend(function (FormGrid $form) {
            $form->fieldset('Role Configuration', function (Fieldset $fieldset) {
                $roles = Role::pluck('name', 'id');

                $fieldset->control('select', 'admin_role')
                    ->label(trans('orchestra/control::label.roles.admin'))
                    ->options($roles);

                $fieldset->control('select', 'member_role')
                    ->label(trans('orchestra/control::label.roles.member'))
                    ->options($roles);
            });

            $form->fieldset('Timezone', function (Fieldset $fieldset) {
                $agreement = ['yes' => 'Yes', 'no' => 'No'];

                $fieldset->control('select', 'localtime')
                    ->attributes(['role' => 'agreement'])
                    ->label(trans('orchestra/control::label.enable-timezone'))
                    ->options($agreement)
                    ->value(function ($row) {
                        return ($row->localtime === true) ? 'yes' : 'no';
                    });
            });
        });
    }
1144893
public function view(UserPolicy $user, Message $message)
    {
        if ($user->canDo('message.message.view') && $user->hasRole('admin')) {
            return true;
        }

        return $user->id == $message->user_id && get_class($user) == $message->user_type;
    }
809269
public function table($model)
    {
        return $this->table->of('orchestra.users', function (TableGrid $table) use ($model) {
            // attach Model and set pagination option to true
            $table->with($model);
            $table->sortable($this->getSortableFields());

            $table->layout('orchestra/foundation::components.table');

            $this->prependTableColumns($model, $table);

            // Add columns
            $table->column('fullname')
                ->label(trans('orchestra/foundation::label.users.fullname'))
                ->escape(false)
                ->value($this->getFullnameColumn());

            $table->column('email')
                ->label(trans('orchestra/foundation::label.users.email'));

            $this->appendTableColumns($model, $table);
        });
    }
471134
public function scopeOfCreator(Builder $builder, Model $user): Builder
    {
        return $builder->where('created_by_type', $user->getMorphClass())->where('created_by_id', $user->getKey());
    }
1173482
protected function passesValidation(User $user, Model $model = null)
    {
        return (new Validator(
            $this->rules($user, $model)
        ))->passes();
    }