You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by di...@apache.org on 2022/09/01 20:48:22 UTC

[allura] branch master updated: [#8459] aded configurable option to prevent installation of wiki tool on new user profiles

This is an automated email from the ASF dual-hosted git repository.

dill0wn 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 51ebf322c [#8459] aded configurable option to prevent installation of wiki tool on new user profiles
51ebf322c is described below

commit 51ebf322c8146b230346ca0d52d3579dfa6f45ff
Author: Guillermo Cruz <gu...@slashdotmedia.com>
AuthorDate: Wed Aug 31 10:48:45 2022 -0600

    [#8459] aded configurable option to prevent installation of wiki tool on new user profiles
---
 Allura/allura/lib/app_globals.py |  3 +++
 Allura/allura/lib/plugin.py      | 17 +++++++++--------
 Allura/allura/model/project.py   |  6 +++---
 Allura/development.ini           |  3 +++
 4 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 6f8c642a7..4ec209205 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -583,6 +583,9 @@ class Globals:
     def user_profile_urls_with_profile_path(self):
         return asbool(config['user_profile_url_with_profile_path'])
 
+    def user_profile_disabled_tools(self):
+        return aslist(config.get('user_prefs.disabled_tools',''), sep=',')
+
     def app_static(self, resource, app=None):
         base = config['static.url_base']
         app = app or c.app
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index 30bf65286..b1d47e3f2 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -1122,14 +1122,15 @@ class ProjectRegistrationProvider:
         if user_project:
             # Allow for special user-only tools
             p._extra_tool_status = ['user']
-            # add user project informative text to home
-            from forgewiki import model as WM
-            home_app = p.app_instance('wiki')
-            home_page = WM.Page.query.get(app_config_id=home_app.config._id)
-            home_page.text = ("This is the personal project of %s."
-                              " This project is created automatically during user registration"
-                              " as an easy place to store personal data that doesn't need its own"
-                              " project such as cloned repositories.") % user.display_name
+            if p.app_config_by_tool_type('wiki'):
+                # add user project informative text to home
+                from forgewiki import model as WM
+                home_app = p.app_instance('wiki')
+                home_page = WM.Page.query.get(app_config_id=home_app.config._id)
+                home_page.text = ("This is the personal project of %s."
+                                  " This project is created automatically during user registration"
+                                  " as an easy place to store personal data that doesn't need its own"
+                                  " project such as cloned repositories.") % user.display_name
 
         # clear the RoleCache for the user so this project will
         # be picked up by user.my_projects()
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index d384b5c01..c0a010f5e 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -1058,9 +1058,9 @@ class Project(SearchIndexable, MappedClass, ActivityNode, ActivityObject):
         if apps is None:
             apps = []
             if is_user_project:
-                apps += [('Wiki', 'wiki', 'Wiki'),
-                         ('profile', 'profile', 'Profile'),
-                         ]
+                if 'wiki' not in g.user_profile_disabled_tools():
+                    apps.append(('Wiki', 'wiki', 'Wiki'))
+                apps.append(('profile', 'profile', 'Profile'))
             apps += [
                 ('admin', 'admin', 'Admin'),
                 ('search', 'search', 'Search'),
diff --git a/Allura/development.ini b/Allura/development.ini
index 9787444fa..4ddbc0c1b 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -250,6 +250,9 @@ user_prefs_storage.ldap.fields.display_name = cn
 ; Limit the number of emails a user can claim.
 user_prefs.maximum_claimed_emails = 20
 
+; Disabled tools by default when creating a user profile
+; user_prefs.disabled_tools =
+
 ; Control the order of sections on the user profile page
 user_profile_sections.order = activity, personal-data, skills, social, tools, projects