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
1c278fd9
Commit
1c278fd9
authored
Sep 18, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update applications controllers to log audit events. Added specs.
parent
c180f007
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
0 deletions
+16
-0
app/controllers/admin/applications_controller.rb
app/controllers/admin/applications_controller.rb
+2
-0
app/controllers/oauth/applications_controller.rb
app/controllers/oauth/applications_controller.rb
+2
-0
spec/controllers/admin/applications_controller_spec.rb
spec/controllers/admin/applications_controller_spec.rb
+1
-0
spec/controllers/oauth/applications_controller_spec.rb
spec/controllers/oauth/applications_controller_spec.rb
+11
-0
No files found.
app/controllers/admin/applications_controller.rb
View file @
1c278fd9
...
...
@@ -22,6 +22,8 @@ class Admin::ApplicationsController < Admin::ApplicationController
@application
=
Doorkeeper
::
Application
.
new
(
application_params
)
if
@application
.
save
log_audit_event
flash
[
:notice
]
=
I18n
.
t
(
:notice
,
scope:
[
:doorkeeper
,
:flash
,
:applications
,
:create
])
redirect_to
admin_application_url
(
@application
)
else
...
...
app/controllers/oauth/applications_controller.rb
View file @
1c278fd9
...
...
@@ -21,6 +21,8 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
@application
.
owner
=
current_user
if
@application
.
save
log_audit_event
flash
[
:notice
]
=
I18n
.
t
(
:notice
,
scope:
[
:doorkeeper
,
:flash
,
:applications
,
:create
])
redirect_to
oauth_application_url
(
@application
)
else
...
...
spec/controllers/admin/applications_controller_spec.rb
View file @
1c278fd9
...
...
@@ -38,6 +38,7 @@ describe Admin::ApplicationsController do
expect
(
response
).
to
redirect_to
(
admin_application_path
(
application
))
expect
(
application
).
to
have_attributes
(
create_params
.
except
(
:uid
,
:owner_type
))
expect
(
SecurityEvent
.
count
).
to
eq
(
1
)
end
it
'renders the application form on errors'
do
...
...
spec/controllers/oauth/applications_controller_spec.rb
View file @
1c278fd9
...
...
@@ -25,5 +25,16 @@ describe Oauth::ApplicationsController do
expect
(
response
).
to
redirect_to
(
profile_path
)
end
end
describe
'POST #create'
do
it
'logs the audit event'
do
sign_in
(
user
)
application
=
build
(
:oauth_application
)
application_attributes
=
application
.
attributes
.
merge
(
scopes:
[])
expect
{
post
:create
,
doorkeeper_application:
application_attributes
}.
to
change
{
SecurityEvent
.
count
}.
by
(
1
)
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