Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
7a0423ea
Commit
7a0423ea
authored
Sep 21, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor a bunch of controllers to make them EE modules
parent
8df3f70c
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
12 deletions
+69
-12
app/controllers/admin/applications_controller.rb
app/controllers/admin/applications_controller.rb
+9
-4
app/controllers/confirmations_controller.rb
app/controllers/confirmations_controller.rb
+6
-4
app/controllers/oauth/applications_controller.rb
app/controllers/oauth/applications_controller.rb
+9
-4
ee/app/controllers/ee/admin/applications_controller.rb
ee/app/controllers/ee/admin/applications_controller.rb
+15
-0
ee/app/controllers/ee/confirmations_controller.rb
ee/app/controllers/ee/confirmations_controller.rb
+15
-0
ee/app/controllers/ee/oauth/applications_controller.rb
ee/app/controllers/ee/oauth/applications_controller.rb
+15
-0
No files found.
app/controllers/admin/applications_controller.rb
View file @
7a0423ea
class
Admin::ApplicationsController
<
Admin
::
ApplicationController
class
Admin::ApplicationsController
<
Admin
::
ApplicationController
include
OauthApplications
include
OauthApplications
prepend
EE
::
Admin
::
ApplicationsController
before_action
:set_application
,
only:
[
:show
,
:edit
,
:update
,
:destroy
]
before_action
:set_application
,
only:
[
:show
,
:edit
,
:update
,
:destroy
]
before_action
:load_scopes
,
only:
[
:new
,
:create
,
:edit
,
:update
]
before_action
:load_scopes
,
only:
[
:new
,
:create
,
:edit
,
:update
]
...
@@ -22,10 +23,7 @@ class Admin::ApplicationsController < Admin::ApplicationController
...
@@ -22,10 +23,7 @@ class Admin::ApplicationsController < Admin::ApplicationController
@application
=
Doorkeeper
::
Application
.
new
(
application_params
)
@application
=
Doorkeeper
::
Application
.
new
(
application_params
)
if
@application
.
save
if
@application
.
save
log_audit_event
redirect_to_admin_page
flash
[
:notice
]
=
I18n
.
t
(
:notice
,
scope:
[
:doorkeeper
,
:flash
,
:applications
,
:create
])
redirect_to
admin_application_url
(
@application
)
else
else
render
:new
render
:new
end
end
...
@@ -44,6 +42,13 @@ class Admin::ApplicationsController < Admin::ApplicationController
...
@@ -44,6 +42,13 @@ class Admin::ApplicationsController < Admin::ApplicationController
redirect_to
admin_applications_url
,
status:
302
,
notice:
'Application was successfully destroyed.'
redirect_to
admin_applications_url
,
status:
302
,
notice:
'Application was successfully destroyed.'
end
end
protected
def
redirect_to_admin_page
flash
[
:notice
]
=
I18n
.
t
(
:notice
,
scope:
[
:doorkeeper
,
:flash
,
:applications
,
:create
])
redirect_to
admin_application_url
(
@application
)
end
private
private
def
set_application
def
set_application
...
...
app/controllers/confirmations_controller.rb
View file @
7a0423ea
class
ConfirmationsController
<
Devise
::
ConfirmationsController
class
ConfirmationsController
<
Devise
::
ConfirmationsController
include
EE
::
Audit
::
Changes
prepend
::
EE
::
ConfirmationsController
def
almost_there
def
almost_there
flash
[
:notice
]
=
nil
flash
[
:notice
]
=
nil
...
@@ -14,12 +14,14 @@ class ConfirmationsController < Devise::ConfirmationsController
...
@@ -14,12 +14,14 @@ class ConfirmationsController < Devise::ConfirmationsController
def
after_confirmation_path_for
(
resource_name
,
resource
)
def
after_confirmation_path_for
(
resource_name
,
resource
)
if
signed_in?
(
resource_name
)
if
signed_in?
(
resource_name
)
audit_changes
(
:email
,
as:
'email address'
,
model:
resource
)
after_sign_in
(
resource
)
after_sign_in_path_for
(
resource
)
else
else
flash
[
:notice
]
+=
" Please sign in."
flash
[
:notice
]
+=
" Please sign in."
new_session_path
(
resource_name
)
new_session_path
(
resource_name
)
end
end
end
end
def
after_sign_in
(
resource
)
after_sign_in_path_for
(
resource
)
end
end
end
app/controllers/oauth/applications_controller.rb
View file @
7a0423ea
...
@@ -3,6 +3,7 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
...
@@ -3,6 +3,7 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
include
Gitlab
::
GonHelper
include
Gitlab
::
GonHelper
include
PageLayoutHelper
include
PageLayoutHelper
include
OauthApplications
include
OauthApplications
prepend
::
EE
::
Oauth
::
ApplicationsController
before_action
:verify_user_oauth_applications_enabled
before_action
:verify_user_oauth_applications_enabled
before_action
:authenticate_user!
before_action
:authenticate_user!
...
@@ -21,16 +22,20 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
...
@@ -21,16 +22,20 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
@application
.
owner
=
current_user
@application
.
owner
=
current_user
if
@application
.
save
if
@application
.
save
log_audit_event
redirect_to_oauth_application_page
flash
[
:notice
]
=
I18n
.
t
(
:notice
,
scope:
[
:doorkeeper
,
:flash
,
:applications
,
:create
])
redirect_to
oauth_application_url
(
@application
)
else
else
set_index_vars
set_index_vars
render
:index
render
:index
end
end
end
end
protected
def
redirect_to_oauth_application_page
flash
[
:notice
]
=
I18n
.
t
(
:notice
,
scope:
[
:doorkeeper
,
:flash
,
:applications
,
:create
])
redirect_to
oauth_application_url
(
@application
)
end
private
private
def
verify_user_oauth_applications_enabled
def
verify_user_oauth_applications_enabled
...
...
ee/app/controllers/ee/admin/applications_controller.rb
0 → 100644
View file @
7a0423ea
module
EE
module
Admin
module
ApplicationsController
protected
def
redirect_to_admin_page
raise
NotImplementedError
unless
defined?
(
super
)
log_audit_event
super
end
end
end
end
ee/app/controllers/ee/confirmations_controller.rb
0 → 100644
View file @
7a0423ea
module
EE
module
ConfirmationsController
include
EE
::
Audit
::
Changes
protected
def
after_sign_in
(
resource
)
raise
NotImplementedError
unless
defined?
(
super
)
audit_changes
(
:email
,
as:
'email address'
,
model:
resource
)
super
(
resource
)
end
end
end
ee/app/controllers/ee/oauth/applications_controller.rb
0 → 100644
View file @
7a0423ea
module
EE
module
Oauth
module
ApplicationsController
protected
def
redirect_to_oauth_application_page
raise
NotImplementedError
unless
defined?
(
super
)
log_audit_event
super
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment