mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-06 22:44:14 +00:00
Added ability to remove permissions
This commit is contained in:
@@ -1,10 +1,30 @@
|
||||
class TournamentsController < ApplicationController
|
||||
before_action :set_tournament, only: [:school_delegate,:delegate,:matches,:weigh_in,:weigh_in_weight,:create_custom_weights,:show,:edit,:update,:destroy,:up_matches,:no_matches,:team_scores,:brackets,:generate_matches,:bracket,:all_brackets]
|
||||
before_filter :check_access_manage, only: [:school_delegate,:weigh_in,:weigh_in_weight,:create_custom_weights,:update,:edit,:generate_matches,:matches]
|
||||
before_filter :check_access_destroy, only: [:destroy,:delegate]
|
||||
before_action :set_tournament, only: [:remove_school_delegate,:remove_delegate,:school_delegate,:delegate,:matches,:weigh_in,:weigh_in_weight,:create_custom_weights,:show,:edit,:update,:destroy,:up_matches,:no_matches,:team_scores,:brackets,:generate_matches,:bracket,:all_brackets]
|
||||
before_filter :check_access_manage, only: [:remove_school_delegate,:school_delegate,:weigh_in,:weigh_in_weight,:create_custom_weights,:update,:edit,:generate_matches,:matches]
|
||||
before_filter :check_access_destroy, only: [:destroy,:delegate,:remove_delegate]
|
||||
|
||||
before_filter :check_for_matches, only: [:up_matches,:bracket,:all_brackets]
|
||||
|
||||
def remove_delegate
|
||||
if params[:delegate]
|
||||
@delegate = TournamentDelegate.find(params[:delegate])
|
||||
@delegate.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to "/tournaments/#{@tournament.id}/delegate", notice: 'Delegated permissions removed successfully' }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def remove_school_delegate
|
||||
if params[:delegate]
|
||||
@delegate = SchoolDelegate.find(params[:delegate])
|
||||
@delegate.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to "/tournaments/#{@tournament.id}/school_delegate", notice: 'Delegated permissions removed successfully' }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def school_delegate
|
||||
if params[:search]
|
||||
@users = User.search(params[:search])
|
||||
|
||||
Reference in New Issue
Block a user