Пример #1
0
 /**
  * RoleListType constructor.
  *
  * @param RoleModel $model
  */
 public function __construct(RoleModel $model)
 {
     $choices = $model->getRepository()->getEntities(['filter' => ['force' => [['column' => 'r.isPublished', 'expr' => 'eq', 'value' => true]]]]);
     foreach ($choices as $choice) {
         $this->choices[$choice->getId()] = $choice->getName(true);
     }
     //sort by language
     ksort($this->choices);
 }
Пример #2
0
 /**
  * @param MauticEvents\CommandListEvent $event
  */
 public function onBuildCommandList(MauticEvents\CommandListEvent $event)
 {
     if ($this->security->isGranted('user:users:view')) {
         $event->addCommands('mautic.user.users', $this->userModel->getCommandList());
     }
     if ($this->security->isGranted('user:roles:view')) {
         $event->addCommands('mautic.user.roles', $this->userRoleModel->getCommandList());
     }
 }