File tree Expand file tree Collapse file tree 5 files changed +9
-3
lines changed Expand file tree Collapse file tree 5 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 2626 < span class ="oi oi-plus "> </ span >
2727 {% trans "New Petition" %}
2828 </ a >
29+ {% if not settings.RESTRICT_ORG_CREATION or perms.petition.add_organization %}
2930 < a class ="dropdown-item " href ="{% url "org_create " %}">
3031 < span class ="oi oi-plus "> </ span >
3132 {% trans "New Organization" %}
3233 </ a >
34+ {% endif %}
3335 < div class ="dropdown-divider "> </ div >
3436 < a class ="dropdown-item " href ="{% url "account_settings " %}">
3537 < span class ="oi oi-cog "> </ span >
Original file line number Diff line number Diff line change @@ -71,9 +71,11 @@ <h5 class="mt-2 mb-2"><a href="{% url 'org_dashboard' org.slugname %}">{{org.nam
7171 {% else %}
7272 < i > {% trans "You are not part of any organization" %}</ i >
7373 {% endif %}
74+ {% if not settings.RESTRICT_ORG_CREATION or perms.petition.add_organization %}
7475 < div class ="text-center mt-5 ">
7576 < a href ="{% url 'org_create' %} " class ="btn btn-primary "> {% trans "Create an Organization" %}</ a >
7677 </ div >
78+ {% endif %}
7779 </ div >
7880 < div class ="tab-pane fade " id ="delete_account_form " role ="tabpanel "
7981 aria-labelledby ="delete-account-form-list ">
Original file line number Diff line number Diff line change 22< div class ="dashboard-nav-item py-3 ">
33 < div class ="d-flex justify-content-between align-items-center flex-wrap ">
44 < h4 > < span class ="oi oi-people "> </ span > {% trans "Organizations" %} ({{ user.organization_set.all.count }})</ h4 >
5- < a href ="{% url "org_create " %}" class="btn btn-outline-primary btn-sm " data-toggle ="tooltip " title ="{% trans "Create a new organization " %}"> {% trans "New organization" %}</ a >
5+ {% if not settings.RESTRICT_ORG_CREATION or perms.petition.add_organization %}
6+ < a href ="{% url "org_create " %}" class="btn btn-outline-primary btn-sm " data-toggle ="tooltip "
7+ title ="{% trans "Create a new organization " %}"> {% trans "New organization" %}</ a >
8+ {% endif %}
69 </ div >
710 < ul class ="dashboard-org-list ">
811 {% for org in user.organization_set.all %}
Original file line number Diff line number Diff line change @@ -1545,7 +1545,7 @@ def account_settings(request):
15451545# Create a new organization
15461546@login_required
15471547def org_create (request ):
1548- if settings .RESTRICT_ORG_CREATION and not request .user .is_superuser :
1548+ if settings .RESTRICT_ORG_CREATION and not request .user .has_perm ( 'petition.add_organization' ) :
15491549 messages .error (request , _ ("Only super users can create an organization." ))
15501550 return redirect ("user_dashboard" )
15511551 user = get_session_user (request )
Original file line number Diff line number Diff line change 265265DISABLE_USER_PETITION = False
266266
267267#:| If set to True, regular users won't be able to create new organizations.
268- #:| Only superusers will be allowed to
269268RESTRICT_ORG_CREATION = False
270269
271270#:| Default address for 'Reply to' field in mail sent on account creation
You can’t perform that action at this time.
0 commit comments