You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

iconfig.php 7.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <?php
  2. /**
  3. * @author Bart Visscher <bartv@thisnet.nl>
  4. * @author Joas Schilling <nickvergessen@owncloud.com>
  5. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  6. * @author Lukas Reschke <lukas@owncloud.com>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Robin Appelman <icewind@owncloud.com>
  9. * @author Thomas Müller <thomas.mueller@tmit.eu>
  10. *
  11. * @copyright Copyright (c) 2016, ownCloud, Inc.
  12. * @license AGPL-3.0
  13. *
  14. * This code is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU Affero General Public License, version 3,
  16. * as published by the Free Software Foundation.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Affero General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Affero General Public License, version 3,
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>
  25. *
  26. */
  27. /**
  28. * Public interface of ownCloud for apps to use.
  29. * Config interface
  30. *
  31. */
  32. // use OCP namespace for all classes that are considered public.
  33. // This means that they should be used by apps instead of the internal ownCloud classes
  34. namespace OCP;
  35. /**
  36. * Access to all the configuration options ownCloud offers
  37. * @since 6.0.0
  38. */
  39. interface IConfig {
  40. /**
  41. * @since 8.2.0
  42. */
  43. const SENSITIVE_VALUE = '***REMOVED SENSITIVE VALUE***';
  44. /**
  45. * Sets and deletes system wide values
  46. *
  47. * @param array $configs Associative array with `key => value` pairs
  48. * If value is null, the config key will be deleted
  49. * @since 8.0.0
  50. */
  51. public function setSystemValues(array $configs);
  52. /**
  53. * Sets a new system wide value
  54. *
  55. * @param string $key the key of the value, under which will be saved
  56. * @param mixed $value the value that should be stored
  57. * @since 8.0.0
  58. */
  59. public function setSystemValue($key, $value);
  60. /**
  61. * Looks up a system wide defined value
  62. *
  63. * @param string $key the key of the value, under which it was saved
  64. * @param mixed $default the default value to be returned if the value isn't set
  65. * @return mixed the value or $default
  66. * @since 6.0.0 - parameter $default was added in 7.0.0
  67. */
  68. public function getSystemValue($key, $default = '');
  69. /**
  70. * Looks up a system wide defined value and filters out sensitive data
  71. *
  72. * @param string $key the key of the value, under which it was saved
  73. * @param mixed $default the default value to be returned if the value isn't set
  74. * @return mixed the value or $default
  75. * @since 8.2.0
  76. */
  77. public function getFilteredSystemValue($key, $default = '');
  78. /**
  79. * Delete a system wide defined value
  80. *
  81. * @param string $key the key of the value, under which it was saved
  82. * @since 8.0.0
  83. */
  84. public function deleteSystemValue($key);
  85. /**
  86. * Get all keys stored for an app
  87. *
  88. * @param string $appName the appName that we stored the value under
  89. * @return string[] the keys stored for the app
  90. * @since 8.0.0
  91. */
  92. public function getAppKeys($appName);
  93. /**
  94. * Writes a new app wide value
  95. *
  96. * @param string $appName the appName that we want to store the value under
  97. * @param string $key the key of the value, under which will be saved
  98. * @param string $value the value that should be stored
  99. * @return void
  100. * @since 6.0.0
  101. */
  102. public function setAppValue($appName, $key, $value);
  103. /**
  104. * Looks up an app wide defined value
  105. *
  106. * @param string $appName the appName that we stored the value under
  107. * @param string $key the key of the value, under which it was saved
  108. * @param string $default the default value to be returned if the value isn't set
  109. * @return string the saved value
  110. * @since 6.0.0 - parameter $default was added in 7.0.0
  111. */
  112. public function getAppValue($appName, $key, $default = '');
  113. /**
  114. * Delete an app wide defined value
  115. *
  116. * @param string $appName the appName that we stored the value under
  117. * @param string $key the key of the value, under which it was saved
  118. * @since 8.0.0
  119. */
  120. public function deleteAppValue($appName, $key);
  121. /**
  122. * Removes all keys in appconfig belonging to the app
  123. *
  124. * @param string $appName the appName the configs are stored under
  125. * @since 8.0.0
  126. */
  127. public function deleteAppValues($appName);
  128. /**
  129. * Set a user defined value
  130. *
  131. * @param string $userId the userId of the user that we want to store the value under
  132. * @param string $appName the appName that we want to store the value under
  133. * @param string $key the key under which the value is being stored
  134. * @param string $value the value that you want to store
  135. * @param string $preCondition only update if the config value was previously the value passed as $preCondition
  136. * @throws \OCP\PreConditionNotMetException if a precondition is specified and is not met
  137. * @since 6.0.0 - parameter $precondition was added in 8.0.0
  138. */
  139. public function setUserValue($userId, $appName, $key, $value, $preCondition = null);
  140. /**
  141. * Shortcut for getting a user defined value
  142. *
  143. * @param string $userId the userId of the user that we want to store the value under
  144. * @param string $appName the appName that we stored the value under
  145. * @param string $key the key under which the value is being stored
  146. * @param mixed $default the default value to be returned if the value isn't set
  147. * @return string
  148. * @since 6.0.0 - parameter $default was added in 7.0.0
  149. */
  150. public function getUserValue($userId, $appName, $key, $default = '');
  151. /**
  152. * Fetches a mapped list of userId -> value, for a specified app and key and a list of user IDs.
  153. *
  154. * @param string $appName app to get the value for
  155. * @param string $key the key to get the value for
  156. * @param array $userIds the user IDs to fetch the values for
  157. * @return array Mapped values: userId => value
  158. * @since 8.0.0
  159. */
  160. public function getUserValueForUsers($appName, $key, $userIds);
  161. /**
  162. * Get the keys of all stored by an app for the user
  163. *
  164. * @param string $userId the userId of the user that we want to store the value under
  165. * @param string $appName the appName that we stored the value under
  166. * @return string[]
  167. * @since 8.0.0
  168. */
  169. public function getUserKeys($userId, $appName);
  170. /**
  171. * Delete a user value
  172. *
  173. * @param string $userId the userId of the user that we want to store the value under
  174. * @param string $appName the appName that we stored the value under
  175. * @param string $key the key under which the value is being stored
  176. * @since 8.0.0
  177. */
  178. public function deleteUserValue($userId, $appName, $key);
  179. /**
  180. * Delete all user values
  181. *
  182. * @param string $userId the userId of the user that we want to remove all values from
  183. * @since 8.0.0
  184. */
  185. public function deleteAllUserValues($userId);
  186. /**
  187. * Delete all user related values of one app
  188. *
  189. * @param string $appName the appName of the app that we want to remove all values from
  190. * @since 8.0.0
  191. */
  192. public function deleteAppFromAllUsers($appName);
  193. /**
  194. * Determines the users that have the given value set for a specific app-key-pair
  195. *
  196. * @param string $appName the app to get the user for
  197. * @param string $key the key to get the user for
  198. * @param string $value the value to get the user for
  199. * @return array of user IDs
  200. * @since 8.0.0
  201. */
  202. public function getUsersForUserValue($appName, $key, $value);
  203. }