1 | <?php |
||
23 | class UserContext extends BaseContext |
||
24 | { |
||
25 | /** @var User */ |
||
26 | private $user; |
||
27 | |||
28 | /** |
||
29 | * Constructs the object. |
||
30 | * |
||
31 | * @param DirectAdmin $connection A prepared connection |
||
32 | * @param bool $validate Whether to check if the connection matches the context |
||
33 | */ |
||
34 | public function __construct(DirectAdmin $connection, $validate = false) |
||
50 | |||
51 | /** |
||
52 | * Returns the type of the account (user/reseller/admin). |
||
53 | * |
||
54 | * @return string One of the DirectAdmin::ACCOUNT_TYPE_ constants describing the type of underlying account |
||
55 | */ |
||
56 | public function getType() |
||
60 | |||
61 | /** |
||
62 | * Returns the actual user object behind the context. |
||
63 | * |
||
64 | * @return User The user object behind the context |
||
65 | */ |
||
66 | public function getContextUser() |
||
73 | |||
74 | /** |
||
75 | * Returns a domain managed by the current user. |
||
76 | * |
||
77 | * @param string $domainName The requested domain name |
||
78 | * @return null|Domain The domain if found, or NULL if it does not exist |
||
79 | */ |
||
80 | public function getDomain($domainName) |
||
84 | |||
85 | /** |
||
86 | * Returns a full list of the domains managed by the current user. |
||
87 | * |
||
88 | * @return Domain[] |
||
89 | */ |
||
90 | public function getDomains() |
||
94 | |||
95 | /** |
||
96 | * Returns the username of the current context. |
||
97 | * |
||
98 | * @return string Username for the current context |
||
99 | */ |
||
100 | public function getUsername() |
||
104 | } |
||
105 |