iconfig.php 6.33 KB
Newer Older
1
<?php
2
/**
Jenkins for ownCloud's avatar
Jenkins for ownCloud committed
3
4
5
6
7
8
9
 * @author Bart Visscher <bartv@thisnet.nl>
 * @author Joas Schilling <nickvergessen@owncloud.com>
 * @author Jörn Friedrich Dreyer <jfd@butonic.de>
 * @author Lukas Reschke <lukas@owncloud.com>
 * @author Morris Jobke <hey@morrisjobke.de>
 * @author Robin Appelman <icewind@owncloud.com>
 * @author Thomas Müller <thomas.mueller@tmit.eu>
10
 *
Jenkins for ownCloud's avatar
Jenkins for ownCloud committed
11
12
 * @copyright Copyright (c) 2015, ownCloud, Inc.
 * @license AGPL-3.0
13
 *
Jenkins for ownCloud's avatar
Jenkins for ownCloud committed
14
15
16
 * This code is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
17
 *
Jenkins for ownCloud's avatar
Jenkins for ownCloud committed
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Jenkins for ownCloud's avatar
Jenkins for ownCloud committed
20
21
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
22
 *
Jenkins for ownCloud's avatar
Jenkins for ownCloud committed
23
24
 * You should have received a copy of the GNU Affero General Public License, version 3,
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
Morris Jobke's avatar
Morris Jobke committed
25
 *
26
 */
27
28
29
30
31
32
33

/**
 * Public interface of ownCloud for apps to use.
 * Config interface
 *
 */

Morris Jobke's avatar
Morris Jobke committed
34
35
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
36
37
38
39
40
41
namespace OCP;

/**
 * Access to all the configuration options ownCloud offers
 */
interface IConfig {
42
43
44
45
46
47
48
49
	/**
	 * Sets and deletes system wide values
	 *
	 * @param array $configs Associative array with `key => value` pairs
	 *                       If value is null, the config key will be deleted
	 */
	public function setSystemValues(array $configs);

50
	/**
Thomas Müller's avatar
Thomas Müller committed
51
	 * Sets a new system wide value
52
	 *
53
	 * @param string $key the key of the value, under which will be saved
54
	 * @param mixed $value the value that should be stored
55
	 */
Lukas Reschke's avatar
Lukas Reschke committed
56
	public function setSystemValue($key, $value);
57
58

	/**
Thomas Müller's avatar
Thomas Müller committed
59
	 * Looks up a system wide defined value
60
	 *
61
	 * @param string $key the key of the value, under which it was saved
Lukas Reschke's avatar
Lukas Reschke committed
62
	 * @param mixed $default the default value to be returned if the value isn't set
63
	 * @return mixed the value or $default
64
	 */
65
	public function getSystemValue($key, $default = '');
66

67
68
69
70
71
72
73
	/**
	 * Delete a system wide defined value
	 *
	 * @param string $key the key of the value, under which it was saved
	 */
	public function deleteSystemValue($key);

74
75
76
77
78
79
80
	/**
	 * Get all keys stored for an app
	 *
	 * @param string $appName the appName that we stored the value under
	 * @return string[] the keys stored for the app
	 */
	public function getAppKeys($appName);
81
82

	/**
Thomas Müller's avatar
Thomas Müller committed
83
	 * Writes a new app wide value
84
	 *
85
	 * @param string $appName the appName that we want to store the value under
86
87
	 * @param string $key the key of the value, under which will be saved
	 * @param string $value the value that should be stored
88
	 * @return void
89
	 */
90
	public function setAppValue($appName, $key, $value);
91
92

	/**
Thomas Müller's avatar
Thomas Müller committed
93
	 * Looks up an app wide defined value
94
	 *
95
	 * @param string $appName the appName that we stored the value under
96
	 * @param string $key the key of the value, under which it was saved
97
	 * @param string $default the default value to be returned if the value isn't set
98
99
	 * @return string the saved value
	 */
100
	public function getAppValue($appName, $key, $default = '');
101

102
103
104
105
106
107
108
109
	/**
	 * Delete an app wide defined value
	 *
	 * @param string $appName the appName that we stored the value under
	 * @param string $key the key of the value, under which it was saved
	 */
	public function deleteAppValue($appName, $key);

110
111
112
113
114
115
116
	/**
	 * Removes all keys in appconfig belonging to the app
	 *
	 * @param string $appName the appName the configs are stored under
	 */
	public function deleteAppValues($appName);

117
118

	/**
119
	 * Set a user defined value
120
	 *
121
122
	 * @param string $userId the userId of the user that we want to store the value under
	 * @param string $appName the appName that we want to store the value under
123
124
	 * @param string $key the key under which the value is being stored
	 * @param string $value the value that you want to store
125
126
	 * @param string $preCondition only update if the config value was previously the value passed as $preCondition
	 * @throws \OCP\PreConditionNotMetException if a precondition is specified and is not met
127
	 */
128
	public function setUserValue($userId, $appName, $key, $value, $preCondition = null);
129
130
131

	/**
	 * Shortcut for getting a user defined value
132
	 *
133
134
	 * @param string $userId the userId of the user that we want to store the value under
	 * @param string $appName the appName that we stored the value under
135
	 * @param string $key the key under which the value is being stored
136
	 * @param string $default the default value to be returned if the value isn't set
137
	 * @return string
138
	 */
139
	public function getUserValue($userId, $appName, $key, $default = '');
140

141
142
143
	/**
	 * Fetches a mapped list of userId -> value, for a specified app and key and a list of user IDs.
	 *
144
145
146
	 * @param string $appName app to get the value for
	 * @param string $key the key to get the value for
	 * @param array $userIds the user IDs to fetch the values for
147
148
149
150
	 * @return array Mapped values: userId => value
	 */
	public function getUserValueForUsers($appName, $key, $userIds);

151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
	/**
	 * Get the keys of all stored by an app for the user
	 *
	 * @param string $userId the userId of the user that we want to store the value under
	 * @param string $appName the appName that we stored the value under
	 * @return string[]
	 */
	public function getUserKeys($userId, $appName);

	/**
	 * Delete a user value
	 *
	 * @param string $userId the userId of the user that we want to store the value under
	 * @param string $appName the appName that we stored the value under
	 * @param string $key the key under which the value is being stored
	 */
	public function deleteUserValue($userId, $appName, $key);
Morris Jobke's avatar
Morris Jobke committed
168
169
170
171
172
173
174

	/**
	 * Delete all user values
	 *
	 * @param string $userId the userId of the user that we want to remove all values from
	 */
	public function deleteAllUserValues($userId);
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191

	/**
	 * Delete all user related values of one app
	 *
	 * @param string $appName the appName of the app that we want to remove all values from
	 */
	public function deleteAppFromAllUsers($appName);

	/**
	 * Determines the users that have the given value set for a specific app-key-pair
	 *
	 * @param string $appName the app to get the user for
	 * @param string $key the key to get the user for
	 * @param string $value the value to get the user for
	 * @return array of user IDs
	 */
	public function getUsersForUserValue($appName, $key, $value);
192
}