mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
acl table
This commit is contained in:
@@ -22,7 +22,30 @@
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
class User extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
use \Espo\Core\Exceptions\Error;
|
||||
use \Espo\Core\Exceptions\NotFound;
|
||||
use \Espo\Core\Exceptions\Forbidden;
|
||||
|
||||
class User extends \Espo\Core\Controllers\Record
|
||||
{
|
||||
public function actionAcl($params, $data, $request)
|
||||
{
|
||||
$userId = $request->get('id');
|
||||
if (empty($userId)) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
if (!$this->getUser()->isAdmin() && $this->getUser()->id != $userId) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
$user = $this->getEntityManager()->getEntity('User', $userId);
|
||||
if (empty($user)) {
|
||||
throw new NotFound();
|
||||
}
|
||||
|
||||
$acl = new \Espo\Core\Acl($user);
|
||||
|
||||
return $acl->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user