Class: MeetingController

Inherits:
ApplicationController show all
Defined in:
lib/rails-authorization-plugin/doc/authorization_example.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#block_api_access, #clean_params_from_check, #evil_parameter_hack!, #extract_header_info, #set_cache_disabled!

Instance Method Details

#find_apprenticeObject


18
19
20
21
22
23
24
25
26
27
# File 'lib/rails-authorization-plugin/doc/authorization_example.rb', line 18

def find_apprentice
  @founder = User.find_by(name: 'matz')
  permit "'inner circle' of :founder" do
    if request.post?
      apprentice = User.find_by(skillset: params[:uber_hacker])
      ruby_community = Group.find_by(name: 'Ruby')
      ruby_community.accepts_role 'yarv_builder', apprentice
    end
  end
end

#public_pageObject


8
9
10
# File 'lib/rails-authorization-plugin/doc/authorization_example.rb', line 8

def public_page
  render plain: "We're all in Chicago"
end

#rails_confObject


29
30
31
32
33
34
35
36
37
38
39
# File 'lib/rails-authorization-plugin/doc/authorization_example.rb', line 29

def rails_conf
  @meeting = Meeting.find_by(name: 'RailsConf')
  permit 'attendees of :meeting or swedish_mensa_supermodels' do
    venue = Hotel.find_by(name: "Wyndham O'Hare")
    current_user.is_traveller_to venue
    if permit? 'traveller to :venue and not speaker'
      Partay.all_night_long
      @misdeeds = current_user.is_participant_in_what
    end
  end
end

#secret_infoObject


12
13
14
15
16
# File 'lib/rails-authorization-plugin/doc/authorization_example.rb', line 12

def secret_info
  permit '(matz or dhh) and interested in Answers' do
    render plain: 'The Answer = 42'
  end
end