aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2015-07-22 13:52:03 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2015-07-22 13:52:03 +0200
commit02c3546440f961018adc1e2c8e97c16f2aca18fc (patch)
tree9a23d9c0e6b0aa3ccea38273b98e5c16413d2b34 /lib
parent9fca5c70f33291cacc04e7bdfa01a12c6df3f97c (diff)
Registration action is handled and create a user
See https://github.com/FreshRSS/FreshRSS/issues/679
Diffstat (limited to 'lib')
-rw-r--r--lib/lib_rss.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index 0118e0f46..c99e2c7e8 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -267,6 +267,22 @@ function listUsers() {
/**
+ * Return if the maximum number of registrations has been reached.
+ *
+ * Note a max_regstrations of 0 means there is no limit.
+ *
+ * @return true if number of users >= max registrations, false else.
+ */
+function max_registrations_reached() {
+ $system_conf = Minz_Configuration::get('system');
+ $limit_registrations = $system_conf->limits['max_registrations'];
+ $number_accounts = count(listUsers());
+
+ return $limit_registrations > 0 && $number_accounts >= $limit_registrations;
+}
+
+
+/**
* Register and return the configuration for a given user.
*
* Note this function has been created to generate temporary configuration