From 180e1a185c465511f1f848f82346afdf5fc31902 Mon Sep 17 00:00:00 2001 From: mistic100 Date: Wed, 30 Oct 2013 20:29:48 +0000 Subject: feature 2976: add three methods for permissions management git-svn-id: http://piwigo.org/svn/trunk@25245 68402e56-0260-453c-a942-63ccdbb3a9ee --- ws.php | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'ws.php') diff --git a/ws.php b/ws.php index d55f9d900..c92523b5a 100644 --- a/ws.php +++ b/ws.php @@ -882,6 +882,58 @@ function ws_addDefaultMethods( $arr ) null, array('admin_only'=>true, 'post_only'=>true) ); + + $service->addMethod( + 'pwg.permissions.getList', + 'ws_permissions_getList', + array( + 'cat_id' => array('flags'=>WS_PARAM_FORCE_ARRAY|WS_PARAM_OPTIONAL, + 'type'=>WS_TYPE_ID), + 'group_id' => array('flags'=>WS_PARAM_FORCE_ARRAY|WS_PARAM_OPTIONAL, + 'type'=>WS_TYPE_ID), + 'user_id' => array('flags'=>WS_PARAM_FORCE_ARRAY|WS_PARAM_OPTIONAL, + 'type'=>WS_TYPE_ID), + ), + 'Admin only. Returns permissions: user ids and group ids having access to each album ; this list can be filterd with "cat_id". +
If "user_id" OR "group_id" is provided it returns a list of album ids the user or group has access to. +
Provide only on parameter!', + null, + array('admin_only'=>true) + ); + + $service->addMethod( + 'pwg.permissions.add', + 'ws_permissions_add', + array( + 'cat_id' => array('flags'=>WS_PARAM_FORCE_ARRAY, + 'type'=>WS_TYPE_ID), + 'group_id' => array('flags'=>WS_PARAM_FORCE_ARRAY|WS_PARAM_OPTIONAL, + 'type'=>WS_TYPE_ID), + 'user_id' => array('flags'=>WS_PARAM_FORCE_ARRAY|WS_PARAM_OPTIONAL, + 'type'=>WS_TYPE_ID), + 'recursive' => array('default'=>false, + 'type'=>WS_TYPE_BOOL), + ), + 'Admin only. Adds permissions to an album.', + null, + array('admin_only'=>true) + ); + + $service->addMethod( + 'pwg.permissions.remove', + 'ws_permissions_remove', + array( + 'cat_id' => array('flags'=>WS_PARAM_FORCE_ARRAY, + 'type'=>WS_TYPE_ID), + 'group_id' => array('flags'=>WS_PARAM_FORCE_ARRAY|WS_PARAM_OPTIONAL, + 'type'=>WS_TYPE_ID), + 'user_id' => array('flags'=>WS_PARAM_FORCE_ARRAY|WS_PARAM_OPTIONAL, + 'type'=>WS_TYPE_ID), + ), + 'Admin & POST only. Removes permissions from an album.', + null, + array('admin_only'=>true, 'post_only'=>true) + ); } ?> \ No newline at end of file -- cgit v1.2.3