You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2020/09/18 16:12:47 UTC

[allura] branch master updated: [#4069] Disallow removal of anon read access from projects when nbhd prevents private projects

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

brondsem 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 bd6ae96  [#4069] Disallow removal of anon read access from projects when nbhd prevents private projects
bd6ae96 is described below

commit bd6ae9605e518d1801f12b6bff3d7926bc134550
Author: Kenton Taylor <kt...@slashdotmedia.com>
AuthorDate: Mon Sep 14 15:27:00 2020 +0000

    [#4069] Disallow removal of anon read access from projects when nbhd prevents private projects
---
 Allura/allura/ext/admin/templates/project_groups.html | 6 ++++++
 Allura/allura/public/nf/js/project_groups.js          | 7 +++++++
 2 files changed, 13 insertions(+)

diff --git a/Allura/allura/ext/admin/templates/project_groups.html b/Allura/allura/ext/admin/templates/project_groups.html
index f468245..9796b7b 100644
--- a/Allura/allura/ext/admin/templates/project_groups.html
+++ b/Allura/allura/ext/admin/templates/project_groups.html
@@ -26,14 +26,18 @@
 
 {% block header %}User Permissions{% endblock %}
 
+{% set private_projects = c.project.neighborhood.features.get('private_projects') %}
+
 {% macro show_perms_for_role(role) %}
   <ul class="permissions">
     {% for perm in permissions_by_role[role._id.__str__()] %}
+    {% if private_projects or (not private_projects and perm['name'] != 'read') or (not private_projects and perm['name'] == 'read') and perm['has'] == 'no' %}
     <li class="{{perm['has']}}" data-permission="{{perm['name']}}">
       {{ g.icons['perm_has_%s'%perm['has']].render(title=perm['text'], closing_tag=False) }}
         {{perm['name']}}
       </a> {# close tag, opened by render #}
     </li>
+    {% endif %}
     {% endfor %}
   </ul>
 {% endmacro %}
@@ -114,6 +118,8 @@
 
 {% block extra_js %}
 <script type="text/javascript">
+  privateProjectsAllowed = {{ 'true' if private_projects else 'false' }};
+
   // these icons are used in the js, so set them up now
   var spinner_img = '<img src="{{g.forge_static('images/spinner.gif')}}">';
   {% set perm_delete_ico = g.icons['perm_delete'].render(title='', extra_css='deleter') %}
diff --git a/Allura/allura/public/nf/js/project_groups.js b/Allura/allura/public/nf/js/project_groups.js
index 4d128e2..fe16a1e 100644
--- a/Allura/allura/public/nf/js/project_groups.js
+++ b/Allura/allura/public/nf/js/project_groups.js
@@ -16,6 +16,7 @@
        specific language governing permissions and limitations
        under the License.
 */
+/*global privateProjectsAllowed */
 
 $(function() {
   var cval = $.cookie('_session_id');
@@ -89,9 +90,15 @@ $(function() {
           perm_link.attr('title',item.text);
           if(item.has=="yes"){
             perm_icon.attr('class','fa fa-check');
+            if (!privateProjectsAllowed) {
+              perm_holder.hide();
+            }
           }
           else if(item.has=="inherit"){
             perm_icon.attr('class','fa fa-check-circle');
+            if(!privateProjectsAllowed){
+              perm_holder.hide();
+            }
           }
           else{
             perm_icon.attr('class','fa fa-ban');