#3267 emlak24 feb. issues

This commit is contained in:
Diatrex 2021-02-26 16:33:35 +03:00
parent b95d4ebf87
commit b863534f49
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,18 @@
<?php namespace Visiosoft\ProfileModule\Profile\Command;
use Anomaly\Streams\Platform\Support\Authorizer;
class Authorize
{
protected $permission;
public function __construct($permission)
{
$this->permission = $permission;
}
public function handle(Authorizer $authorizer)
{
return $authorizer->authorize($this->permission);
}
}

View File

@ -3,6 +3,7 @@
use Anomaly\Streams\Platform\Addon\Plugin\Plugin;
use Visiosoft\ProfileModule\Adress\Command\GetAddress;
use Visiosoft\ProfileModule\Adress\Command\GetAddressByUser;
use Visiosoft\ProfileModule\Profile\Command\Authorize;
use Visiosoft\ProfileModule\Profile\Command\GetProfileDetail;
class ProfileModulePlugin extends Plugin
@ -45,6 +46,12 @@ class ProfileModulePlugin extends Plugin
return $ad;
}
),
new \Twig_SimpleFunction(
'authorize',
function ($permission) {
return $this->dispatch(new Authorize($permission));
}
)
];
}