Account.php 3.8 KB

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