Account.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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_ENABLE_FORWARD = 'zimbraFeatureMailForwardingEnabled';
  38. const ATTR_CLASS_OF_SERVICE_ID = 'zimbraCOSId';
  39. protected $id;
  40. protected $name;
  41. protected $password;
  42. protected $attrs;
  43. protected $limit;
  44. protected $used;
  45. /**
  46. * @return mixed
  47. */
  48. public function getName()
  49. {
  50. return $this->name;
  51. }
  52. /**
  53. * @param $name
  54. * @return $this
  55. */
  56. public function setName($name)
  57. {
  58. $this->name = $name;
  59. return $this;
  60. }
  61. /**
  62. * @return mixed
  63. */
  64. public function getPassword()
  65. {
  66. return $this->password;
  67. }
  68. /**
  69. * @param $password
  70. * @return $this
  71. */
  72. public function setPassword($password)
  73. {
  74. $this->password = $password;
  75. return $this;
  76. }
  77. /**
  78. * @return mixed
  79. */
  80. public function getId()
  81. {
  82. return $this->id;
  83. }
  84. /**
  85. * @param $id
  86. * @return $this
  87. */
  88. public function setId($id)
  89. {
  90. $this->id = $id;
  91. return $this;
  92. }
  93. /**
  94. * @return mixed
  95. */
  96. public function getLimit()
  97. {
  98. return $this->limit;
  99. }
  100. /**
  101. * @param $limit
  102. * @return $this
  103. */
  104. public function setLimit($limit = 0)
  105. {
  106. $this->limit = $limit;
  107. return $this;
  108. }
  109. /**
  110. * @return mixed
  111. */
  112. public function getUsed()
  113. {
  114. return $this->used;
  115. }
  116. /**
  117. * @param $used
  118. * @return $this
  119. */
  120. public function setUsed($used = 0)
  121. {
  122. $this->used = $used;
  123. return $this;
  124. }
  125. /**
  126. * @return mixed
  127. */
  128. public function getAttrs()
  129. {
  130. return $this->attrs;
  131. }
  132. /**
  133. * @param $key
  134. * @param null $value
  135. * @return $this
  136. */
  137. public function setAttr($key, $value = null)
  138. {
  139. $this->attrs[$key] = $value;
  140. return $this;
  141. }
  142. /**
  143. * @param $key
  144. * @return mixed
  145. */
  146. public function getAttr($key)
  147. {
  148. return $this->attrs[$key];
  149. }
  150. /**
  151. * @param $attrs
  152. * @return $this
  153. */
  154. public function setAttrs($attrs = [])
  155. {
  156. $this->attrs = $attrs;
  157. return $this;
  158. }
  159. /**
  160. * @return mixed
  161. */
  162. public function getCosId()
  163. {
  164. return $this->getDataResourceA(self::ATTR_CLASS_OF_SERVICE_ID);
  165. }
  166. /**
  167. * @return mixed
  168. */
  169. public function getAliases()
  170. {
  171. foreach($this->resources['a'] as $res)
  172. {
  173. if($res['N'] === self::ATTR_ALIAS)
  174. {
  175. $tmp[$res['DATA']] = $res['DATA'];
  176. }
  177. }
  178. return $tmp;
  179. }
  180. }