Change user key manager interface to abstract key validation
This commit is contained in:
parent
46f7068b38
commit
1c8f115935
1 changed files with 19 additions and 3 deletions
|
@ -33,13 +33,29 @@ interface userkey_manager_interface {
|
|||
/**
|
||||
* Create a user key.
|
||||
*
|
||||
* @param int $userid User ID.
|
||||
* @param null|array $allowedips A list of allowed ips for this key.
|
||||
*
|
||||
* @return string Generated key.
|
||||
*/
|
||||
public function create_key();
|
||||
public function create_key($userid, $allowedips = null);
|
||||
|
||||
/**
|
||||
* Delete a user key.
|
||||
* Delete all keys for a specific user.
|
||||
*
|
||||
* @param int $userid User ID.
|
||||
*/
|
||||
public function delete_key();
|
||||
public function delete_keys($userid);
|
||||
|
||||
/**
|
||||
* Validates key and returns key data object if valid.
|
||||
*
|
||||
* @param string $keyvalue Key value.
|
||||
*
|
||||
* @return object Key object including userid property.
|
||||
*
|
||||
* @throws \moodle_exception If provided key is not valid.
|
||||
*/
|
||||
public function validate_key($keyvalue);
|
||||
|
||||
}
|
Loading…
Reference in a new issue