mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-07 17:23:04 +02:00
fixes #2355 implement API key management system
- Added API key get, creation, editing, and revocation methods. - Updated the profile template to include API key management features. - Updated the database schema to support the new API key system, including additional fields for key management. - Added client-side JavaScript functionality to handle API key operations and display responses. - Update tools/htm.ws with the new way to authenticate. - Restriction of certain api methods when used with an api key - Backward compatibility with older apps
This commit is contained in:
@@ -1567,6 +1567,58 @@ enabled_high, registration_date, registration_date_string, registration_date_sin
|
||||
$ws_functions_root . 'pwg.users.php',
|
||||
array('admin_only'=>true, 'post_only'=>true)
|
||||
);
|
||||
|
||||
$service->addMethod(
|
||||
'pwg.users.api_key.create',
|
||||
'ws_create_api_key',
|
||||
array(
|
||||
'key_name' => array(),
|
||||
'duration' => array(
|
||||
'type' => WS_TYPE_INT|WS_TYPE_POSITIVE,
|
||||
'info' => 'Number of days',
|
||||
),
|
||||
'pwg_token' => array(),
|
||||
),
|
||||
'Create a new api key for the user in the current session',
|
||||
$ws_functions_root . 'pwg.users.php',
|
||||
array('admin_only'=>false, 'post_only'=>true)
|
||||
);
|
||||
|
||||
$service->addMethod(
|
||||
'pwg.users.api_key.revoke',
|
||||
'ws_revoke_api_key',
|
||||
array(
|
||||
'pkid' => array(),
|
||||
'pwg_token' => array(),
|
||||
),
|
||||
'Revoke a api key for the user in the current session',
|
||||
$ws_functions_root . 'pwg.users.php',
|
||||
array('admin_only'=>false, 'post_only'=>true)
|
||||
);
|
||||
|
||||
$service->addMethod(
|
||||
'pwg.users.api_key.edit',
|
||||
'ws_edit_api_key',
|
||||
array(
|
||||
'key_name' => array(),
|
||||
'pkid' => array(),
|
||||
'pwg_token' => array(),
|
||||
),
|
||||
'Edit a api key for the user in the current session',
|
||||
$ws_functions_root . 'pwg.users.php',
|
||||
array('admin_only'=>false, 'post_only'=>true)
|
||||
);
|
||||
|
||||
$service->addMethod(
|
||||
'pwg.users.api_key.get',
|
||||
'ws_get_api_key',
|
||||
array(
|
||||
'pwg_token' => array(),
|
||||
),
|
||||
'Get all api key for the user in the current session',
|
||||
$ws_functions_root . 'pwg.users.php',
|
||||
array('admin_only'=>false, 'post_only'=>true)
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user