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
0
Merge Requests
0
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
Tatuya Kamada
gitlab-ce
Commits
7d5d5e53
Commit
7d5d5e53
authored
Jan 17, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'doorkeeper_applications_scafold'
parents
045fe895
a81081aa
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
146 additions
and
6 deletions
+146
-6
app/controllers/admin/applications_controller.rb
app/controllers/admin/applications_controller.rb
+52
-0
app/controllers/oauth/applications_controller.rb
app/controllers/oauth/applications_controller.rb
+2
-4
app/views/admin/applications/_delete_form.html.haml
app/views/admin/applications/_delete_form.html.haml
+4
-0
app/views/admin/applications/_form.html.haml
app/views/admin/applications/_form.html.haml
+24
-0
app/views/admin/applications/edit.html.haml
app/views/admin/applications/edit.html.haml
+3
-0
app/views/admin/applications/index.html.haml
app/views/admin/applications/index.html.haml
+22
-0
app/views/admin/applications/new.html.haml
app/views/admin/applications/new.html.haml
+3
-0
app/views/admin/applications/show.html.haml
app/views/admin/applications/show.html.haml
+26
-0
app/views/layouts/nav/_admin.html.haml
app/views/layouts/nav/_admin.html.haml
+7
-1
config/initializers/doorkeeper.rb
config/initializers/doorkeeper.rb
+1
-1
config/routes.rb
config/routes.rb
+2
-0
No files found.
app/controllers/admin/applications_controller.rb
0 → 100644
View file @
7d5d5e53
class
Admin::ApplicationsController
<
Admin
::
ApplicationController
before_action
:set_application
,
only:
[
:show
,
:edit
,
:update
,
:destroy
]
def
index
@applications
=
Doorkeeper
::
Application
.
where
(
"owner_id IS NULL"
)
end
def
show
end
def
new
@application
=
Doorkeeper
::
Application
.
new
end
def
edit
end
def
create
@application
=
Doorkeeper
::
Application
.
new
(
application_params
)
if
@application
.
save
flash
[
:notice
]
=
I18n
.
t
(
:notice
,
scope:
[
:doorkeeper
,
:flash
,
:applications
,
:create
])
redirect_to
admin_application_url
(
@application
)
else
render
:new
end
end
def
update
if
@application
.
update
(
application_params
)
redirect_to
admin_application_path
(
@application
),
notice:
'Application was successfully updated.'
else
render
:edit
end
end
def
destroy
@application
.
destroy
redirect_to
admin_applications_url
,
notice:
'Application was successfully destroyed.'
end
private
def
set_application
@application
=
Doorkeeper
::
Application
.
where
(
"owner_id IS NULL"
).
find
(
params
[
:id
])
end
# Only allow a trusted parameter "white list" through.
def
application_params
params
[
:doorkeeper_application
].
permit
(
:name
,
:redirect_uri
)
end
end
app/controllers/oauth/applications_controller.rb
View file @
7d5d5e53
...
@@ -9,10 +9,8 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
...
@@ -9,10 +9,8 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
def
create
def
create
@application
=
Doorkeeper
::
Application
.
new
(
application_params
)
@application
=
Doorkeeper
::
Application
.
new
(
application_params
)
if
Doorkeeper
.
configuration
.
confirm_application_owner?
@application
.
owner
=
current_user
@application
.
owner
=
current_user
end
if
@application
.
save
if
@application
.
save
flash
[
:notice
]
=
I18n
.
t
(
:notice
,
scope:
[
:doorkeeper
,
:flash
,
:applications
,
:create
])
flash
[
:notice
]
=
I18n
.
t
(
:notice
,
scope:
[
:doorkeeper
,
:flash
,
:applications
,
:create
])
redirect_to
oauth_application_url
(
@application
)
redirect_to
oauth_application_url
(
@application
)
...
...
app/views/admin/applications/_delete_form.html.haml
0 → 100644
View file @
7d5d5e53
-
submit_btn_css
||=
'btn btn-link btn-remove btn-small'
=
form_tag
admin_application_path
(
application
)
do
%input
{
:name
=>
"_method"
,
:type
=>
"hidden"
,
:value
=>
"delete"
}
/
=
submit_tag
'Destroy'
,
onclick:
"return confirm('Are you sure?')"
,
class:
submit_btn_css
\ No newline at end of file
app/views/admin/applications/_form.html.haml
0 → 100644
View file @
7d5d5e53
=
form_for
[
:admin
,
@application
],
url:
@url
,
html:
{
class:
'form-horizontal'
,
role:
'form'
}
do
|
f
|
-
if
application
.
errors
.
any?
.alert.alert-danger
{
"data-alert"
=>
""
}
%p
Whoops! Check your form for possible errors
=
content_tag
:div
,
class:
"form-group
#{
' has-error'
if
application
.
errors
[
:name
].
present?
}
"
do
=
f
.
label
:name
,
class:
'col-sm-2 control-label'
.col-sm-10
=
f
.
text_field
:name
,
class:
'form-control'
=
doorkeeper_errors_for
application
,
:name
=
content_tag
:div
,
class:
"form-group
#{
' has-error'
if
application
.
errors
[
:redirect_uri
].
present?
}
"
do
=
f
.
label
:redirect_uri
,
class:
'col-sm-2 control-label'
.col-sm-10
=
f
.
text_area
:redirect_uri
,
class:
'form-control'
=
doorkeeper_errors_for
application
,
:redirect_uri
%span
.help-block
Use one line per URI
-
if
Doorkeeper
.
configuration
.
native_redirect_uri
%span
.help-block
Use
%code
=
Doorkeeper
.
configuration
.
native_redirect_uri
for local tests
.form-actions
=
f
.
submit
'Submit'
,
class:
"btn btn-primary wide"
=
link_to
"Cancel"
,
admin_applications_path
,
class:
"btn btn-default"
app/views/admin/applications/edit.html.haml
0 → 100644
View file @
7d5d5e53
%h3
.page-title
Edit application
-
@url
=
admin_application_path
(
@application
)
=
render
'form'
,
application:
@application
\ No newline at end of file
app/views/admin/applications/index.html.haml
0 → 100644
View file @
7d5d5e53
%h3
.page-title
System OAuth applications
%p
.light
System OAuth application does not belong to certain user and can be managed only by admins
%hr
%p
=
link_to
'New Application'
,
new_admin_application_path
,
class:
'btn btn-success'
%table
.table.table-striped
%thead
%tr
%th
Name
%th
Callback URL
%th
Clients
%th
%th
%tbody
-
@applications
.
each
do
|
application
|
%tr
{
:id
=>
"application_#{application.id}"
}
%td
=
link_to
application
.
name
,
admin_application_path
(
application
)
%td
=
application
.
redirect_uri
%td
=
application
.
access_tokens
.
count
%td
=
link_to
'Edit'
,
edit_admin_application_path
(
application
),
class:
'btn btn-link'
%td
=
render
'delete_form'
,
application:
application
app/views/admin/applications/new.html.haml
0 → 100644
View file @
7d5d5e53
%h3
.page-title
New application
-
@url
=
admin_applications_path
=
render
'form'
,
application:
@application
\ No newline at end of file
app/views/admin/applications/show.html.haml
0 → 100644
View file @
7d5d5e53
%h3
.page-title
Application:
#{
@application
.
name
}
%table
.table
%tr
%td
Application Id
%td
%code
#application_id
=
@application
.
uid
%tr
%td
Secret:
%td
%code
#secret
=
@application
.
secret
%tr
%td
Callback url
%td
-
@application
.
redirect_uri
.
split
.
each
do
|
uri
|
%div
%span
.monospace
=
uri
.form-actions
=
link_to
'Edit'
,
edit_admin_application_path
(
@application
),
class:
'btn btn-primary wide pull-left'
=
render
'delete_form'
,
application:
@application
,
submit_btn_css:
'btn btn-danger prepend-left-10'
app/views/layouts/nav/_admin.html.haml
View file @
7d5d5e53
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
Projects
Projects
=
nav_link
(
controller: :users
)
do
=
nav_link
(
controller: :users
)
do
=
link_to
admin_users_path
do
=
link_to
admin_users_path
do
%i
.fa.fa-user
s
%i
.fa.fa-user
%span
%span
Users
Users
=
nav_link
(
controller: :groups
)
do
=
nav_link
(
controller: :groups
)
do
...
@@ -45,3 +45,9 @@
...
@@ -45,3 +45,9 @@
%i
.fa.fa-cogs
%i
.fa.fa-cogs
%span
%span
Settings
Settings
=
nav_link
(
controller: :applications
)
do
=
link_to
admin_applications_path
do
%i
.fa.fa-cloud
%span
Applications
config/initializers/doorkeeper.rb
View file @
7d5d5e53
...
@@ -40,7 +40,7 @@ Doorkeeper.configure do
...
@@ -40,7 +40,7 @@ Doorkeeper.configure do
# Optional parameter :confirmation => true (default false) if you want to enforce ownership of
# Optional parameter :confirmation => true (default false) if you want to enforce ownership of
# a registered application
# a registered application
# Note: you must also run the rails g doorkeeper:application_owner generator to provide the necessary support
# Note: you must also run the rails g doorkeeper:application_owner generator to provide the necessary support
enable_application_owner
:confirmation
=>
tru
e
enable_application_owner
:confirmation
=>
fals
e
# Define access token scopes for your provider
# Define access token scopes for your provider
# For more information go to
# For more information go to
...
...
config/routes.rb
View file @
7d5d5e53
...
@@ -97,6 +97,8 @@ Gitlab::Application.routes.draw do
...
@@ -97,6 +97,8 @@ Gitlab::Application.routes.draw do
end
end
end
end
resources
:applications
resources
:groups
,
constraints:
{
id:
/[^\/]+/
}
do
resources
:groups
,
constraints:
{
id:
/[^\/]+/
}
do
member
do
member
do
put
:project_teams_update
put
:project_teams_update
...
...
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