Class: AuthorizationsController
Instance Method Summary
collapse
#after_sign_in_path_for, #api_authenticate!, #current_project, #expire_revision!, #followed_projects, #no_cache, #read_revision, #require_login, #return_or_cache_revision!, #revision, #unfurling?, #with_current_project
Methods included from UrlHelper
#feature_path, #link_to_project_feature
Instance Method Details
#create ⇒ Object
15
16
17
18
19
20
21
22
23
24
|
# File 'app/controllers/authorizations_controller.rb', line 15
def create
@authorization = Authorization.new(params[:authorization])
authorize! :create, @authorization
if @authorization.save
redirect_to authorizations_path
else
render action: :new
end
end
|
#edit ⇒ Object
26
27
28
29
30
|
# File 'app/controllers/authorizations_controller.rb', line 26
def edit
@title = "Edit Authorization"
@authorization = Authorization.find params[:id]
authorize! :update, Authorization
end
|
#grant ⇒ Object
43
44
45
46
47
48
49
50
51
|
# File 'app/controllers/authorizations_controller.rb', line 43
def grant
@authorization = Authorization.find(params[:id])
if @authorization.granted?
redirect_to authorizations_url, notice: "Already Granted"
else
puts "\e[96;4m#{@authorization.authorize_url}\e[0m"
redirect_to @authorization.authorize_url
end
end
|
#granted ⇒ Object
58
59
|
# File 'app/controllers/authorizations_controller.rb', line 58
def granted
end
|
#index ⇒ Object
3
4
5
6
7
|
# File 'app/controllers/authorizations_controller.rb', line 3
def index
@title = "Authorizations"
authorize! :read, Authorization
@authorizations = Authorization.all
end
|
#new ⇒ Object
9
10
11
12
13
|
# File 'app/controllers/authorizations_controller.rb', line 9
def new
@title = "New Authorization"
authorize! :create, Authorization
@authorization = Authorization.new
end
|
#oauth2_callback ⇒ Object
53
54
55
56
|
# File 'app/controllers/authorizations_controller.rb', line 53
def oauth2_callback
authorization = Authorization.set_access_token! params
redirect_to authorization_granted_url(authorization)
end
|
#update ⇒ Object
32
33
34
35
36
37
38
39
40
41
|
# File 'app/controllers/authorizations_controller.rb', line 32
def update
@authorization = Authorization.find params[:id]
authorize! :update, Authorization
if @authorization.update_attributes(params[:authorization])
redirect_to authorizations_path
else
render action: :new
end
end
|