Skip to content
Snippets Groups Projects
Commit 3ddd9f75 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Fix mass-assignment. Dont allow users w/o access to create team

parent 70e05801
No related branches found
No related tags found
1 merge request!2940Expanding repos and hooks paths in settings
Loading
Loading
@@ -94,6 +94,10 @@ class ApplicationController < ActionController::Base
return access_denied! unless can?(current_user, :download_code, project)
end
 
def authorize_create_team!
return access_denied! unless can?(current_user, :create_team, nil)
end
def authorize_manage_user_team!
return access_denied! unless user_team.present? && can?(current_user, :manage_user_team, user_team)
end
Loading
Loading
class TeamsController < ApplicationController
# Authorize
before_filter :authorize_manage_user_team!
before_filter :authorize_admin_user_team!
before_filter :authorize_create_team!, only: [:new, :create]
before_filter :authorize_manage_user_team!, only: [:edit, :update]
before_filter :authorize_admin_user_team!, only: [:destroy]
 
# Skip access control on public section
skip_before_filter :authorize_manage_user_team!, only: [:index, :show, :new, :destroy, :create, :search, :issues, :merge_requests]
skip_before_filter :authorize_admin_user_team!, only: [:index, :show, :new, :create, :search, :issues, :merge_requests]
layout 'user_team', only: [:show, :edit, :update, :destroy, :issues, :merge_requests, :search]
layout 'user_team', except: [:new, :create]
 
def index
@teams = current_user.user_teams.order('name ASC')
Loading
Loading
Loading
Loading
@@ -40,7 +40,7 @@ class User < ActiveRecord::Base
attr_accessible :email, :password, :password_confirmation, :remember_me, :bio, :name, :username,
:skype, :linkedin, :twitter, :dark_scheme, :theme_id, :force_random_password,
:extern_uid, :provider, as: [:default, :admin]
attr_accessible :projects_limit, as: :admin
attr_accessible :projects_limit, :can_create_team, :can_create_group, as: :admin
 
attr_accessor :force_random_password
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment