From 4c060074b792519e23403c0b21d4c2b3b49a8f36 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 14 Sep 2015 11:05:23 +0200 Subject: [PATCH] Skip auth for group page but return auth for other group pages --- app/assets/stylesheets/generic/sidebar.scss | 2 +- app/controllers/groups_controller.rb | 2 +- app/models/ability.rb | 2 +- app/models/group.rb | 4 ++++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/generic/sidebar.scss b/app/assets/stylesheets/generic/sidebar.scss index 22720c2e1d5..fdc554f3a91 100644 --- a/app/assets/stylesheets/generic/sidebar.scss +++ b/app/assets/stylesheets/generic/sidebar.scss @@ -146,7 +146,6 @@ } .collapse-nav a { - left: 0px; width: $sidebar_collapsed_width; } @@ -165,6 +164,7 @@ width: $sidebar_width; position: fixed; bottom: 0; + left: 0; font-size: 13px; background: transparent; height: 40px; diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 279c6ef0f4d..9f4702c6f53 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -4,7 +4,7 @@ class GroupsController < Groups::ApplicationController before_action :group, except: [:new, :create] # Authorize - before_action :authorize_read_group!, except: [:new, :create] + before_action :authorize_read_group!, except: [:show, :new, :create] before_action :authorize_admin_group!, only: [:edit, :update, :destroy, :projects] before_action :authorize_create_group!, only: [:new, :create] diff --git a/app/models/ability.rb b/app/models/ability.rb index 64cfdb6ea89..f8e5afa9b01 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -54,7 +54,7 @@ class Ability nil end - if group + if group && group.public_profile? [:read_group] else [] diff --git a/app/models/group.rb b/app/models/group.rb index 702d7825d57..9cd146bb73b 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -119,6 +119,10 @@ class Group < Namespace end end + def public_profile? + projects.public_only.any? + end + def post_create_hook Gitlab::AppLogger.info("Group \"#{name}\" was created")