1 <?php
2
3 4 5 6 7 8 9
10
11 namespace Omines\DirectAdmin\Objects\Users;
12
13 use Omines\DirectAdmin\Context\AdminContext;
14 use Omines\DirectAdmin\Context\UserContext;
15 use Omines\DirectAdmin\DirectAdminException;
16
17 18 19 20 21
22 class Admin extends Reseller
23 {
24 25 26
27 public function __construct($name, UserContext $context, $config = null)
28 {
29 parent::__construct($name, $context, $config);
30 }
31
32 33 34
35 public function impersonate()
36 {
37
38 if (!($context = $this->getContext()) instanceof AdminContext) {
39 throw new DirectAdminException('You need to be an admin to impersonate another admin');
40 }
41 return $context->impersonateAdmin($this->getUsername());
42 }
43 }
44