aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-07-15 21:57:41 -0700
committerredmatrix <git@macgirvin.com>2016-07-15 21:57:41 -0700
commit8e667866fd2cb834563b1eee8fadf6eedec77660 (patch)
tree45d7cac81eac785b4496eb04c1425a64b9858253 /Zotlabs/Module
parent01fe7d6620644daa8c73ed34aa5b9e4bf832db15 (diff)
downloadvolse-hubzilla-8e667866fd2cb834563b1eee8fadf6eedec77660.tar.gz
volse-hubzilla-8e667866fd2cb834563b1eee8fadf6eedec77660.tar.bz2
volse-hubzilla-8e667866fd2cb834563b1eee8fadf6eedec77660.zip
add service class restrictions to access_tokens
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Settings.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/Zotlabs/Module/Settings.php b/Zotlabs/Module/Settings.php
index ccc5ec04a..b1258e049 100644
--- a/Zotlabs/Module/Settings.php
+++ b/Zotlabs/Module/Settings.php
@@ -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);