This is an automated email from the ASF dual-hosted git repository.
gcruz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
The following commit(s) were added to refs/heads/master by this push:
new 1dea36f13 skip per-user and per-nbhd limit checks when creating a user
project
1dea36f13 is described below
commit 1dea36f1360a8ff8277bbdec3e85320db2931014
Author: Dave Brondsema <[email protected]>
AuthorDate: Fri Jul 5 14:07:32 2024 -0400
skip per-user and per-nbhd limit checks when creating a user project
---
Allura/allura/lib/plugin.py | 34 ++++++++++++++++++----------------
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index 5f3add94c..0dea14d29 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -1008,22 +1008,24 @@ class ProjectRegistrationProvider:
"You can't create private projects in the %s neighborhood" %
neighborhood.name)
- # Check for project limit creation
- nb_max_projects = neighborhood.get_max_projects()
- if nb_max_projects is not None:
- count = M.Project.query.find(dict(
- neighborhood_id=neighborhood._id,
- deleted=False,
- is_nbhd_project=False,
- )).count()
- if count >= nb_max_projects:
- log.exception('Error registering project %s' % project_name)
- raise forge_exc.ProjectOverlimitError()
-
- self.rate_limit(user, neighborhood)
-
- if not self.phone_verified(user, neighborhood) and not user_project:
- raise forge_exc.ProjectPhoneVerificationError()
+ if not user_project: # user-projects should not be subject to these
limits
+
+ # Check for project limit creation
+ nb_max_projects = neighborhood.get_max_projects()
+ if nb_max_projects is not None:
+ count = M.Project.query.find(dict(
+ neighborhood_id=neighborhood._id,
+ deleted=False,
+ is_nbhd_project=False,
+ )).count()
+ if count >= nb_max_projects:
+ log.exception('Error registering project %s' %
project_name)
+ raise forge_exc.ProjectOverlimitError()
+
+ self.rate_limit(user, neighborhood)
+
+ if not self.phone_verified(user, neighborhood):
+ raise forge_exc.ProjectPhoneVerificationError()
if user_project and shortname.startswith('u/'):
check_shortname = shortname.replace('u/', '', 1)