add service class restrictions to access_tokens
This commit is contained in:
@@ -132,6 +132,16 @@ class Settings extends \Zotlabs\Web\Controller {
|
||||
$expires = datetime_convert(date_default_timezone_get(),'UTC',$_POST['expires']);
|
||||
else
|
||||
$expires = NULL_DATE;
|
||||
$max_atokens = service_class_fetch(local_channel(),'access_tokens');
|
||||
if($max_atokens) {
|
||||
$r = q("select count(atoken_id) as total where atoken_uid = %d",
|
||||
intval(local_channel())
|
||||
);
|
||||
if($r && intval($r[0]['total']) >= $max_tokens) {
|
||||
notice( sprintf( t('This channel is limited to %d tokens'), $max_tokens) . EOL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($token_errs) {
|
||||
notice( t('Name and Password are required.') . EOL);
|
||||
|
||||
Reference in New Issue
Block a user