Account.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <?php
  2. namespace ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Models;
  3. use ModulesGarden\Servers\ZimbraEmail\App\Libs\Zimbra\Components\Api\Soap\Interfaces\AbstractModel;
  4. /**
  5. *
  6. * Created by PhpStorm.
  7. * User: Tomasz Bielecki ( tomasz.bi@modulesgarden.com )
  8. * Date: 10.09.19
  9. * Time: 08:43
  10. * Class Account
  11. */
  12. class Account extends AbstractModel
  13. {
  14. /**
  15. * Account Attributes
  16. */
  17. const ATTR_FIRSTNAME = 'givenName';
  18. const ATTR_LASTNAME = 'sn';
  19. const ATTR_PHONE = 'telephoneNumber';
  20. const ATTR_MOBILE_PHONE = 'mobile';
  21. const ATTR_FAX = 'facsimileTelephoneNumber';
  22. const ATTR_PAGER = 'pager';
  23. const ATTR_HOME_PHONE = 'homePhone';
  24. const ATTR_COUNTRY = 'co';
  25. const ATTR_STATE = 'st';
  26. const ATTR_POSTAL_CODE = 'postalCode';
  27. const ATTR_CITY = 'l';
  28. const ATTR_STREET = 'street';
  29. const ATTR_COMPANY = 'company';
  30. const ATTR_PROF_TITLE = 'title';
  31. const ATTR_ACCOUNT_STATUS = 'zimbraAccountStatus';
  32. const ATTR_DISPLAY_NAME = 'displayName';
  33. const ATTR_MAIL_QUOTA = 'zimbraMailQuota';
  34. const ATTR_ALIAS = 'zimbraMailAlias';
  35. const ATTR_MAIL_FORWARD = 'zimbraPrefMailForwardingAddress';
  36. const ATTR_DISABLE_LOCAL = 'zimbraPrefMailLocalDeliveryDisabled';
  37. const ATTR_CLASS_OF_SERVICE_ID = 'zimbraCOSId';
  38. protected $id;
  39. protected $name;
  40. protected $password;
  41. protected $attrs;
  42. protected $limit;
  43. protected $used;
  44. /**
  45. * @return mixed
  46. */
  47. public function getName()
  48. {
  49. return $this->name;
  50. }
  51. /**
  52. * @param $name
  53. * @return $this
  54. */
  55. public function setName($name)
  56. {
  57. $this->name = $name;
  58. return $this;
  59. }
  60. /**
  61. * @return mixed
  62. */
  63. public function getPassword()
  64. {
  65. return $this->password;
  66. }
  67. /**
  68. * @param $password
  69. * @return $this
  70. */
  71. public function setPassword($password)
  72. {
  73. $this->password = $password;
  74. return $this;
  75. }
  76. /**
  77. * @return mixed
  78. */
  79. public function getId()
  80. {
  81. return $this->id;
  82. }
  83. /**
  84. * @param $id
  85. * @return $this
  86. */
  87. public function setId($id)
  88. {
  89. $this->id = $id;
  90. return $this;
  91. }
  92. /**
  93. * @return mixed
  94. */
  95. public function getLimit()
  96. {
  97. return $this->limit;
  98. }
  99. /**
  100. * @param $limit
  101. * @return $this
  102. */
  103. public function setLimit($limit = 0)
  104. {
  105. $this->limit = $limit;
  106. return $this;
  107. }
  108. /**
  109. * @return mixed
  110. */
  111. public function getUsed()
  112. {
  113. return $this->used;
  114. }
  115. /**
  116. * @param $used
  117. * @return $this
  118. */
  119. public function setUsed($used = 0)
  120. {
  121. $this->used = $used;
  122. return $this;
  123. }
  124. /**
  125. * @return mixed
  126. */
  127. public function getAttrs()
  128. {
  129. return $this->attrs;
  130. }
  131. /**
  132. * @param $key
  133. * @param null $value
  134. * @return $this
  135. */
  136. public function setAttr($key, $value = null)
  137. {
  138. $this->attrs[$key] = $value;
  139. return $this;
  140. }
  141. /**
  142. * @param $key
  143. * @return mixed
  144. */
  145. public function getAttr($key)
  146. {
  147. return $this->attrs[$key];
  148. }
  149. /**
  150. * @param $attrs
  151. * @return $this
  152. */
  153. public function setAttrs($attrs = [])
  154. {
  155. $this->attrs = $attrs;
  156. return $this;
  157. }
  158. /**
  159. * @return mixed
  160. */
  161. public function getCosId()
  162. {
  163. return $this->getDataResourceA(self::ATTR_CLASS_OF_SERVICE_ID);
  164. }
  165. /**
  166. * @return mixed
  167. */
  168. public function getAliases()
  169. {
  170. foreach($this->resources['a'] as $res)
  171. {
  172. if($res['N'] === self::ATTR_ALIAS)
  173. {
  174. $tmp[$res['DATA']] = $res['DATA'];
  175. }
  176. }
  177. return $tmp;
  178. }
  179. }