public function action() { Exits::exit403If(!Operator::currentOperatorHasAnyOfPermissions([Permissions::PERMISSION_PHPAUTH_MANAGE_OPERATORS])); $operator_id = $this->operator_id; $operator_obj = Operator::factory($operator_id); $html = '<div class="col-md-6">'; $html .= '<h2>Параметры</h2>'; $html .= CRUDForm::html($operator_obj, [new CRUDFormRow('title', new CRUDFormWidgetInput('title')), new CRUDFormRow('описание', new CRUDFormWidgetTextarea('description')), new CRUDFormRow('User id', new CRUDFormWidgetReferenceAjax('user_id', User::class, 'login', (new UsersListAjaxAction())->url(), (new UserEditAction('REFERENCED_ID'))->url()))]); $new_operator_permission_obj = new OperatorPermission(); $new_operator_permission_obj->setOperatorId($operator_id); $html .= '</div><div class="col-md-6">'; if (Operator::currentOperatorHasAnyOfPermissions([Permissions::PERMISSION_PHPAUTH_MANAGE_OPERATORS])) { $html .= '<h2>Назначенные разрешения</h2>'; $html .= HTML::div('', '', function () use($operator_id) { $new_permissiontouser_obj = new OperatorPermission(); $new_permissiontouser_obj->setOperatorId($operator_id); echo CRUDTable::html(OperatorPermission::class, '', [new \OLOG\CRUD\CRUDTableColumn('Разрешение', new \OLOG\CRUD\CRUDTableWidgetText('{' . Permission::class . '.{this->permission_id}->title}')), new \OLOG\CRUD\CRUDTableColumn('Удалить', new \OLOG\CRUD\CRUDTableWidgetDelete())], [new CRUDTableFilterEqualInvisible('operator_id', $operator_id)], ''); echo CallapsibleWidget::buttonAndCollapse('Показать все неназначенные разрешения', function () use($operator_id) { $html = CRUDTable::html(Permission::class, '', [new CRUDTableColumn('Разрешение', new CRUDTableWidgetTextWithLink('{this->title}', (new PermissionAddToOperatorAction($operator_id, '{this->id}'))->url())), new CRUDTableColumn('', new CRUDTableWidgetTextWithLink('Добавить оператору', (new PermissionAddToOperatorAction($operator_id, '{this->id}'))->url(), 'btn btn-default btn-xs'))], [new CRUDTableFilterNotInInvisible('id', OperatorPermission::getPermissionIdsArrForOperatorId($operator_id))], 'id', '79687tg8976rt87'); return $html; }); }); } $html .= '</div>'; AdminLayoutSelector::render($html, $this); }
public static function menuArr() { $menu_arr = []; if (Operator::currentOperatorHasAnyOfPermissions([Permissions::PERMISSION_PHPAUTH_MANAGE_USERS, Permissions::PERMISSION_PHPAUTH_MANAGE_GROUPS, Permissions::PERMISSION_PHPAUTH_MANAGE_OPERATORS])) { $menu_arr = [new MenuItem('Пользователи', '', [new MenuItem((new UsersListAction())->pageTitle(), (new UsersListAction())->url(), [], 'glyphicon glyphicon-user'), new MenuItem((new OperatorsListAction())->pageTitle(), (new OperatorsListAction())->url(), [], 'glyphicon glyphicon-eye-open'), new MenuItem((new PermissionsListAction())->pageTitle(), (new PermissionsListAction())->url(), [], 'glyphicon glyphicon-check'), new MenuItem((new GroupsListAction())->pageTitle(), (new GroupsListAction())->url(), [], 'glyphicon glyphicon-check')], 'glyphicon glyphicon-log-in')]; } return $menu_arr; }
public function action() { Exits::exit403If(!Operator::currentOperatorHasAnyOfPermissions([Permissions::PERMISSION_PHPAUTH_MANAGE_OPERATORS])); $permissiontouser_obj = new OperatorPermission(); $permissiontouser_obj->setOperatorId($this->operator_id); $permissiontouser_obj->setPermissionId($this->permission_id); $permissiontouser_obj->save(); \OLOG\Redirects::redirect((new OperatorEditAction($this->operator_id))->url()); }
public function action() { Exits::exit403If(!Operator::currentOperatorHasAnyOfPermissions([Permissions::PERMISSION_PHPAUTH_MANAGE_OPERATORS, Permissions::PERMISSION_PHPAUTH_MANAGE_USERS])); $html = ''; $html .= '<div>' . HTML::a((new PermissionsListAction())->url(), 'Разрешения') . '</div>'; $html .= '<div>' . HTML::a((new UsersListAction())->url(), 'Пользователи') . '</div>'; $html .= '<div>' . HTML::a((new GroupsListAction())->url(), 'Группы') . '</div>'; $html .= '<div>' . HTML::a((new OperatorsListAction())->url(), 'Операторы') . '</div>'; AdminLayoutSelector::render($html, $this); }
public function action() { Exits::exit403If(!Operator::currentOperatorHasAnyOfPermissions([Permissions::PERMISSION_PHPAUTH_MANAGE_OPERATORS])); $html = \OLOG\CRUD\CRUDTable::html(\OLOG\Auth\Permission::class, null, [new \OLOG\CRUD\CRUDTableColumn('ID', new \OLOG\CRUD\CRUDTableWidgetText('{this->id}')), new \OLOG\CRUD\CRUDTableColumn('title', new \OLOG\CRUD\CRUDTableWidgetText('{this->title}'))]); AdminLayoutSelector::render($html, $this); }
public static function userInGroupsTable($user_id) { if (!Operator::currentOperatorHasAnyOfPermissions([Permissions::PERMISSION_PHPAUTH_MANAGE_GROUPS])) { return ''; } $html = ''; $html .= '<h2>В составе групп</h2>'; $new_user_to_group_obj = new UserToGroup(); $new_user_to_group_obj->setUserId($user_id); $html .= CRUDTable::html(UserToGroup::class, CRUDForm::html($new_user_to_group_obj, [new CRUDFormInvisibleRow(new CRUDFormWidgetInput(UserToGroup::_USER_ID)), new CRUDFormRow('Группа', new CRUDFormWidgetReferenceAjax(UserToGroup::_GROUP_ID, Group::class, Group::_TITLE, (new GroupsListAjaxAction())->url(), (new GroupEditAction('REFERENCED_ID'))->url(), true))]), [new CRUDTableColumn('Группа', new CRUDTableWidgetTextWithLink('{' . Group::class . '.{this->' . UserToGroup::_GROUP_ID . '}->' . Group::_TITLE . '}', (new GroupEditAction('{this->' . UserToGroup::_GROUP_ID . '}'))->url())), new CRUDTableColumn('Удалить', new CRUDTableWidgetDelete())], [new CRUDTableFilterEqualInvisible(UserToGroup::_USER_ID, $user_id)]); return $html; }
public function action() { Exits::exit403If(!Operator::currentOperatorHasAnyOfPermissions([Permissions::PERMISSION_PHPAUTH_MANAGE_OPERATORS])); $html = \OLOG\CRUD\CRUDTable::html(\OLOG\Auth\Operator::class, CRUDForm::html(new Operator(), [new CRUDFormRow('user_id', new CRUDFormWidgetReference('user_id', User::class, 'login')), new CRUDFormRow('title', new CRUDFormWidgetInput('title')), new CRUDFormRow('Описание', new CRUDFormWidgetTextarea('description'))]), [new \OLOG\CRUD\CRUDTableColumn('ID', new \OLOG\CRUD\CRUDTableWidgetTextWithLink('{this->id}', (new OperatorEditAction('{this->id}'))->url())), new \OLOG\CRUD\CRUDTableColumn('title', new \OLOG\CRUD\CRUDTableWidgetText('{this->title}')), new \OLOG\CRUD\CRUDTableColumn('описание', new \OLOG\CRUD\CRUDTableWidgetText('{this->description}')), new \OLOG\CRUD\CRUDTableColumn('login', new \OLOG\CRUD\CRUDTableWidgetText('{\\OLOG\\Auth\\User.{this->user_id}->login}'))], [new CRUDTableFilterLike('title_1287318', 'title', 'title'), new CRUDTableFilterLike('description_1287318', 'описание', 'description')], '', '1', \OLOG\CRUD\CRUDTable::FILTERS_POSITION_TOP); AdminLayoutSelector::render($html, $this); }
public function action() { Exits::exit403If(!Operator::currentOperatorHasAnyOfPermissions([Permissions::PERMISSION_PHPAUTH_MANAGE_USERS])); $html = \OLOG\CRUD\CRUDTable::html(\OLOG\Auth\User::class, CRUDForm::html(new User(), [new CRUDFormRow('login', new CRUDFormWidgetInput('login')), new CRUDFormRow('Комментарий', new CRUDFormWidgetTextarea('description'))]), [new \OLOG\CRUD\CRUDTableColumn('Логин', new \OLOG\CRUD\CRUDTableWidgetTextWithLink('{this->login}', (new UserEditAction('{this->id}'))->url())), new \OLOG\CRUD\CRUDTableColumn('Создан', new \OLOG\CRUD\CRUDTableWidgetTimestamp('{this->created_at_ts}')), new \OLOG\CRUD\CRUDTableColumn('Комментарий', new \OLOG\CRUD\CRUDTableWidgetText('{this->description}')), new \OLOG\CRUD\CRUDTableColumn('Основная группа', new \OLOG\CRUD\CRUDTableWidgetText('{' . Group::class . '.{this->' . User::_PRIMARY_GROUP_ID . '}->title}')), new \OLOG\CRUD\CRUDTableColumn('Удалить', new \OLOG\CRUD\CRUDTableWidgetDelete())], [new CRUDTableFilterLike('login_1287318', 'login', 'login'), new CRUDTableFilterLike('description_1287318', 'комментарий', 'description'), new \OLOG\Auth\CRUDTableFilterOwnerInvisible()], 'login', '1', \OLOG\CRUD\CRUDTable::FILTERS_POSITION_TOP); AdminLayoutSelector::render($html, $this); }
public function action() { Exits::exit403If(!Operator::currentOperatorHasAnyOfPermissions([Permissions::PERMISSION_PHPAUTH_MANAGE_GROUPS])); $html = \OLOG\CRUD\CRUDTable::html(\OLOG\Auth\Group::class, CRUDForm::html(new Group(), [new CRUDFormRow('title', new CRUDFormWidgetInput(Group::_TITLE))]), [new \OLOG\CRUD\CRUDTableColumn('Title', new \OLOG\CRUD\CRUDTableWidgetTextWithLink('{this->' . Group::_TITLE . '}', (new GroupEditAction('{this->id}'))->url())), new \OLOG\CRUD\CRUDTableColumn('Создана', new \OLOG\CRUD\CRUDTableWidgetTimestamp('{this->created_at_ts}')), new \OLOG\CRUD\CRUDTableColumn('Удалить', new \OLOG\CRUD\CRUDTableWidgetDelete())], [new CRUDTableFilterLike('wgieruygfigfe', 'Title', Group::_TITLE), new CRUDTableFilterOwnerInvisible()], 'title', '1', \OLOG\CRUD\CRUDTable::FILTERS_POSITION_TOP); AdminLayoutSelector::render($html, $this); }
public static function usersInGroupTable($group_id) { if (!Operator::currentOperatorHasAnyOfPermissions([Permissions::PERMISSION_PHPAUTH_MANAGE_USERS])) { return ''; } $html = '<h2>Пользователи в группе</h2>'; $new_user_to_group_obj = new UserToGroup(); $new_user_to_group_obj->setGroupId($group_id); $html .= CRUDTable::html(UserToGroup::class, CRUDForm::html($new_user_to_group_obj, [new CRUDFormInvisibleRow(new CRUDFormWidgetInput(UserToGroup::_GROUP_ID)), new CRUDFormRow('Пользователь', new CRUDFormWidgetReferenceAjax(UserToGroup::_USER_ID, User::class, User::_LOGIN, (new UsersListAjaxAction())->url(), (new UserEditAction('REFERENCED_ID'))->url(), true))]), [new CRUDTableColumn('Логин', new \OLOG\CRUD\CRUDTableWidgetTextWithLink('{' . User::class . '.{this->' . UserToGroup::_USER_ID . '}->' . User::_LOGIN . '}', (new UserEditAction('{this->' . UserToGroup::_USER_ID . '}'))->url())), new CRUDTableColumn('Удалить', new CRUDTableWidgetDelete())], [new CRUDTableFilterEqualInvisible(UserToGroup::_GROUP_ID, $group_id)]); return $html; }
public function action() { Exits::exit403If(!Operator::currentOperatorHasAnyOfPermissions([Permissions::PERMISSION_PHPAUTH_MANAGE_GROUPS])); $html = \OLOG\CRUD\CRUDTable::html(\OLOG\Auth\Group::class, '', [new \OLOG\CRUD\CRUDTableColumn('', new \OLOG\CRUD\CRUDTableWidgetReferenceSelect(\OLOG\Auth\Group::_TITLE)), new \OLOG\CRUD\CRUDTableColumn('Название', new \OLOG\CRUD\CRUDTableWidgetText('{this->' . \OLOG\Auth\Group::_TITLE . '}')), new \OLOG\CRUD\CRUDTableColumn('Создана', new \OLOG\CRUD\CRUDTableWidgetTimestamp('{this->' . \OLOG\Auth\Group::_CREATED_AT_TS . '}'))], [new CRUDTableFilterOwnerInvisible()], 'title'); echo $html; }
public function action() { Exits::exit403If(!Operator::currentOperatorHasAnyOfPermissions([Permissions::PERMISSION_PHPAUTH_MANAGE_USERS])); $html = \OLOG\CRUD\CRUDTable::html(\OLOG\Auth\User::class, '', [new \OLOG\CRUD\CRUDTableColumn('Логин', new \OLOG\CRUD\CRUDTableWidgetReferenceSelect('login')), new \OLOG\CRUD\CRUDTableColumn('Логин', new \OLOG\CRUD\CRUDTableWidgetText('{this->login}')), new \OLOG\CRUD\CRUDTableColumn('Создан', new \OLOG\CRUD\CRUDTableWidgetText('{this->created_at_ts}'))], [new CRUDTableFilterLike('login', 'login', ''), new CRUDTableFilterOwnerInvisible()]); echo $html; }