acl table

This commit is contained in:
Yuri Kuznetsov
2014-04-07 15:46:44 +03:00
parent af0c09c88d
commit 36870f031f
3 changed files with 36 additions and 8 deletions

View File

@@ -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();
}
}