您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

users.inc.php 6.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <?php
  2. /* Poweradmin, a friendly web-based admin tool for PowerDNS.
  3. * See <http://www.poweradmin.org> for more details.
  4. *
  5. * Copyright 2007-2009 Rejo Zenger <rejo@zenger.nl>
  6. * Copyright 2010-2017 Poweradmin Development Team
  7. * <http://www.poweradmin.org/credits.html>
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation, either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. */
  22. /**
  23. * User profile functions
  24. *
  25. * @package Poweradmin
  26. * @copyright 2007-2010 Rejo Zenger <rejo@zenger.nl>
  27. * @copyright 2010-2017 Poweradmin Development Team
  28. * @license http://opensource.org/licenses/GPL-3.0 GPL
  29. */
  30. /*
  31. * these are the standard listeners.
  32. * if you want to use your own put them first or replace them
  33. * first read gets used;
  34. */
  35. /**
  36. * Verify User has Permission Name
  37. *
  38. * Function to see if user has right to do something. It will check if
  39. * user has "ueberuser" bit set. If it isn't, it will check if the user has
  40. * the specific permission. It returns "false" if the user doesn't have the
  41. * right, and "true" if the user has.
  42. *
  43. * @param array arg[0] Permission name
  44. *
  45. * @return boolean true if user has permission, false otherwise
  46. *
  47. */
  48. add_listener('verify_permission', 'verify_permission_local');
  49. /**
  50. * Retrieve all users
  51. *
  52. * Its to show_users therefore the odd name. Has to be changed.
  53. *
  54. * @param int $id Exclude User ID
  55. * @param int $rowstart Startring row number
  56. * @param int $rowamount Number of rows to return this query
  57. *
  58. * @return mixed[] array with all users [id,username,fullname,email,description,active,numdomains]
  59. */
  60. add_listener('show_users', 'show_users_local');
  61. /**
  62. * Change User Password
  63. *
  64. * Change the pass of the user.
  65. * The user is automatically logged out after the pass change.
  66. *
  67. * @param mixed[] $details User Details
  68. *
  69. * @return null
  70. */
  71. add_listener('change_user_pass', 'change_user_pass_local');
  72. /**
  73. * Get a list of all available permission templates
  74. *
  75. * @return mixed[] array of templates [id, name, descr]
  76. */
  77. add_listener('list_permission_templates', 'list_permission_templates_local');
  78. /**
  79. * Check if Valid User
  80. *
  81. * Check if the given $userid is connected to a valid user.
  82. *
  83. * @param int $id User ID
  84. *
  85. * @return boolean true if user exists, false if users doesnt exist
  86. */
  87. add_listener('is_valid_user', 'is_valid_user_local');
  88. /**
  89. * Delete User ID
  90. *
  91. * Delete a user from the system. Will also delete zones owned by user or
  92. * re-assign those zones to a new specified owner.
  93. * $zones is an array of zone 'zid's to delete or re-assign depending on
  94. * 'target' value [delete,new_owner] and 'newowner' value
  95. *
  96. * @param int $uid User ID to delete
  97. * @param mixed[] $zones Array of zones
  98. *
  99. * @return boolean true on success, false otherwise
  100. */
  101. add_listener('delete_user', 'delete_user_local');
  102. /**
  103. * Delete Permission Template ID
  104. *
  105. * @param int $ptid Permission template ID
  106. *
  107. * @return boolean true on success, false otherwise
  108. */
  109. add_listener('delete_perm_templ', 'delete_perm_templ_local');
  110. /**
  111. * Modify User Details
  112. *
  113. * Edit the information of an user.. sloppy implementation with too many queries.. (2) :)
  114. *
  115. * @param int $id User ID
  116. * @param string $user Username
  117. * @param string $fullname Full Name
  118. * @param string $email Email address
  119. * @param string $perm_templ Permission Template Name
  120. * @param string $description Description
  121. * @param int $active Active User
  122. * @param string $password Password
  123. *
  124. * @return boolean true if succesful, false otherwise
  125. */
  126. add_listener('edit_user', 'edit_user_local');
  127. /**
  128. * Get User FullName from User ID
  129. *
  130. * Get a fullname when you have a userid.
  131. *
  132. * @param int $id
  133. * User ID
  134. *
  135. * @return string Full Name
  136. */
  137. add_listener('get_fullname_from_userid', 'get_fullname_from_userid_local');
  138. /**
  139. * Get User FullName from User ID
  140. * fixme: Duplicate function
  141. *
  142. * Get a fullname when you have a userid.
  143. *
  144. * @param int $id User ID
  145. *
  146. * @return string Full Name
  147. */
  148. add_listener('get_owner_from_id', 'get_owner_from_id_local');
  149. /**
  150. * Get Full Names of owners for a Domain ID
  151. *
  152. * @todo also fetch the subowners
  153. *
  154. * @param int $id Domain ID
  155. *
  156. * @return string[] array of owners for domain
  157. */
  158. add_listener('get_fullnames_owners_from_domainid', 'get_fullnames_owners_from_domainid_local');
  159. /**
  160. * Verify User is Zone ID owner
  161. *
  162. * @param int $zoneid Zone ID
  163. *
  164. * @return int 1 if owner, 0 if not owner
  165. */
  166. add_listener('verify_user_is_owner_zoneid', 'verify_user_is_owner_zoneid_local');
  167. /**
  168. * Get User Details
  169. *
  170. * Gets an array of all users and their details
  171. *
  172. * @param int $specific User ID (optional)
  173. *
  174. * @return mixed[] array of user details
  175. */
  176. add_listener('get_user_detail_list', 'get_user_detail_list_local');
  177. /**
  178. * Get List of Permissions
  179. *
  180. * Get a list of permissions that are available. If first argument is "0", it
  181. * should return all available permissions. If the first argument is > "0", it
  182. * should return the permissions assigned to that particular template only. If
  183. * second argument is true, only the permission names are returned.
  184. *
  185. * @param int $templ_id Template ID (optional) [default=0]
  186. * @param boolean $return_name_only Return name only or all details (optional) [default=false]
  187. *
  188. * @return mixed[] array of permissions [id,name,descr] or permission names [name]
  189. */
  190. add_listener('get_permissions_by_template_id', 'get_permissions_by_template_id_local');
  191. /**
  192. * Get name and description of template from Template ID
  193. *
  194. * @param int $templ_id Template ID
  195. *
  196. * @return mixed[] Template details
  197. */
  198. add_listener('get_permission_template_details', 'get_permission_template_details_local');
  199. /**
  200. * Add a Permission Template
  201. *
  202. * @param mixed[] $details Permission template details [templ_name,templ_descr,perm_id]
  203. *
  204. * @return boolean true on success, false otherwise
  205. */
  206. add_listener('add_perm_templ', 'add_perm_templ_local');
  207. /**
  208. * Update permission template details
  209. *
  210. * @param mixed[] $details Permission Template Details
  211. *
  212. * @return boolean true on success, false otherwise
  213. */
  214. add_listener('update_perm_templ_details', 'update_perm_templ_details_local');
  215. /**
  216. * Update User Details
  217. *
  218. * @param mixed[] $details User details
  219. *
  220. * @return boolean true on success, false otherise
  221. */
  222. add_listener('update_user_details', 'update_user_details_local');
  223. /**
  224. * Add a new user
  225. *
  226. * @param mixed[] $details Array of User details
  227. *
  228. * @return boolean true on success, false otherwise
  229. */
  230. add_listener('add_new_user', 'add_new_user_local');