@@ -253,6 +253,41 @@ let searchRequestCancelSource = null
253
253
254
254
const actions = {
255
255
256
+ /**
257
+ * search users
258
+ *
259
+ * @param {object } context store context
260
+ * @param {object } options destructuring object
261
+ * @param {number } options.offset List offset to request
262
+ * @param {number } options.limit List number to return from offset
263
+ * @param {string } options.search Search amongst users
264
+ * @return {Promise }
265
+ */
266
+ searchUsers ( context , { offset, limit, search } ) {
267
+ search = typeof search === 'string' ? search : ''
268
+
269
+ return api . get ( generateOcsUrl ( 'cloud/users/details?offset={offset}&limit={limit}&search={search}' , { offset, limit, search } ) ) . catch ( ( error ) => {
270
+ if ( ! axios . isCancel ( error ) ) {
271
+ context . commit ( 'API_FAILURE' , error )
272
+ }
273
+ } )
274
+ } ,
275
+
276
+ /**
277
+ * Get user details
278
+ *
279
+ * @param {object } context store context
280
+ * @param {string } userId user id
281
+ * @return {Promise }
282
+ */
283
+ getUser ( context , userId ) {
284
+ return api . get ( generateOcsUrl ( `cloud/users/${ userId } ` ) ) . catch ( ( error ) => {
285
+ if ( ! axios . isCancel ( error ) ) {
286
+ context . commit ( 'API_FAILURE' , error )
287
+ }
288
+ } )
289
+ } ,
290
+
256
291
/**
257
292
* Get all users with full details
258
293
*
@@ -548,11 +583,12 @@ const actions = {
548
583
* @param {string } options.subadmin User subadmin groups
549
584
* @param {string } options.quota User email
550
585
* @param {string } options.language User language
586
+ * @param {string } options.manager User manager
551
587
* @return {Promise }
552
588
*/
553
- addUser ( { commit, dispatch } , { userid, password, displayName, email, groups, subadmin, quota, language } ) {
589
+ addUser ( { commit, dispatch } , { userid, password, displayName, email, groups, subadmin, quota, language, manager } ) {
554
590
return api . requireAdmin ( ) . then ( ( response ) => {
555
- return api . post ( generateOcsUrl ( 'cloud/users' ) , { userid, password, displayName, email, groups, subadmin, quota, language } )
591
+ return api . post ( generateOcsUrl ( 'cloud/users' ) , { userid, password, displayName, email, groups, subadmin, quota, language, manager } )
556
592
. then ( ( response ) => dispatch ( 'addUserData' , userid || response . data . ocs . data . id ) )
557
593
. catch ( ( error ) => { throw error } )
558
594
} ) . catch ( ( error ) => {
@@ -605,8 +641,8 @@ const actions = {
605
641
* @return {Promise }
606
642
*/
607
643
setUserData ( context , { userid, key, value } ) {
608
- const allowedEmpty = [ 'email' , 'displayname' ]
609
- if ( [ 'email' , 'language' , 'quota' , 'displayname' , 'password' ] . indexOf ( key ) !== - 1 ) {
644
+ const allowedEmpty = [ 'email' , 'displayname' , 'manager' ]
645
+ if ( [ 'email' , 'language' , 'quota' , 'displayname' , 'password' , 'manager' ] . indexOf ( key ) !== - 1 ) {
610
646
// We allow empty email or displayname
611
647
if ( typeof value === 'string'
612
648
&& (
0 commit comments