BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
90e91e28
Commit
90e91e28
authored
Mar 15, 2016
by
Robert Speicher
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'application-settings' into 'master'
Applications tab on profile settings Closes #13855 See merge request !3031
parents
ea7d062f
8f21e2ae
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
143 additions
and
135 deletions
+143
-135
variables.scss
app/assets/stylesheets/framework/variables.scss
+4
-0
profile.scss
app/assets/stylesheets/pages/profile.scss
+18
-0
applications_controller.rb
app/controllers/oauth/applications_controller.rb
+14
-10
profiles_controller.rb
app/controllers/profiles_controller.rb
+0
-7
_delete_form.html.haml
app/views/doorkeeper/applications/_delete_form.html.haml
+7
-2
_form.html.haml
app/views/doorkeeper/applications/_form.html.haml
+13
-18
index.html.haml
app/views/doorkeeper/applications/index.html.haml
+81
-17
_profile.html.haml
app/views/layouts/nav/_profile.html.haml
+1
-1
applications.html.haml
app/views/profiles/applications.html.haml
+0
-70
routes.rb
config/routes.rb
+1
-1
profile.feature
features/profile/profile.feature
+1
-2
profile.rb
features/steps/profile/profile.rb
+3
-7
No files found.
app/assets/stylesheets/framework/variables.scss
View file @
90e91e28
...
...
@@ -103,6 +103,10 @@ $border-red-dark: #CA264F;
$help-well-bg
:
#FAFAFA
;
$help-well-border
:
#E5E5E5
;
$warning-message-bg
:
#FBF2D9
;
$warning-message-color
:
#9E8E60
;
$warning-message-border
:
#F0E2BB
;
/* header */
$light-grey-header
:
#faf9f9
;
...
...
app/assets/stylesheets/pages/profile.scss
View file @
90e91e28
...
...
@@ -215,3 +215,21 @@
color
:
$provider-btn-not-active-color
;
}
}
.profile-settings-message
{
line-height
:
32px
;
color
:
$warning-message-color
;
background-color
:
$warning-message-bg
;
border
:
1px
solid
$warning-message-border
;
border-radius
:
$border-radius-base
;
}
.oauth-applications
{
form
{
display
:
inline-block
;
}
.last-heading
{
width
:
105px
;
}
}
app/controllers/oauth/applications_controller.rb
View file @
90e91e28
...
...
@@ -8,7 +8,7 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
layout
'profile'
def
index
head
:forbidden
and
return
set_index_vars
end
def
create
...
...
@@ -20,18 +20,11 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
flash
[
:notice
]
=
I18n
.
t
(
:notice
,
scope:
[
:doorkeeper
,
:flash
,
:applications
,
:create
])
redirect_to
oauth_application_url
(
@application
)
else
render
:new
set_index_vars
render
:index
end
end
def
destroy
if
@application
.
destroy
flash
[
:notice
]
=
I18n
.
t
(
:notice
,
scope:
[
:doorkeeper
,
:flash
,
:applications
,
:destroy
])
end
redirect_to
applications_profile_url
end
private
def
verify_user_oauth_applications_enabled
...
...
@@ -40,6 +33,17 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
redirect_to
applications_profile_url
end
def
set_index_vars
@applications
=
current_user
.
oauth_applications
@authorized_tokens
=
current_user
.
oauth_authorized_tokens
@authorized_anonymous_tokens
=
@authorized_tokens
.
reject
(
&
:application
)
@authorized_apps
=
@authorized_tokens
.
map
(
&
:application
).
uniq
.
reject
(
&
:nil?
)
# Don't overwrite a value possibly set by `create`
@application
||=
Doorkeeper
::
Application
.
new
end
# Override Doorkeeper to scope to the current user
def
set_application
@application
=
current_user
.
oauth_applications
.
find
(
params
[
:id
])
end
...
...
app/controllers/profiles_controller.rb
View file @
90e91e28
...
...
@@ -8,13 +8,6 @@ class ProfilesController < Profiles::ApplicationController
def
show
end
def
applications
@applications
=
current_user
.
oauth_applications
@authorized_tokens
=
current_user
.
oauth_authorized_tokens
@authorized_anonymous_tokens
=
@authorized_tokens
.
reject
(
&
:application
)
@authorized_apps
=
@authorized_tokens
.
map
(
&
:application
).
uniq
-
[
nil
]
end
def
update
user_params
.
except!
(
:email
)
if
@user
.
ldap_user?
...
...
app/views/doorkeeper/applications/_delete_form.html.haml
View file @
90e91e28
-
submit_btn_css
||=
'btn btn-link btn-remove btn-sm'
=
form_tag
oauth_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
-
if
defined?
small
=
button_tag
type:
"submit"
,
class:
"btn btn-transparent"
,
data:
{
confirm:
"Are you sure?"
}
do
%span
.sr-only
Destroy
=
icon
(
'trash'
)
-
else
=
submit_tag
'Destroy'
,
data:
{
confirm:
"Are you sure?"
},
class:
submit_btn_css
app/views/doorkeeper/applications/_form.html.haml
View file @
90e91e28
=
form_for
application
,
url:
doorkeeper_submit_path
(
application
),
html:
{
class:
'form-horizontal'
,
role:
'form'
}
do
|
f
|
=
form_for
application
,
url:
doorkeeper_submit_path
(
application
),
html:
{
role:
'form'
}
do
|
f
|
-
if
application
.
errors
.
any?
.alert.alert-danger
%ul
...
...
@@ -6,25 +6,20 @@
%li
=
msg
.form-group
=
f
.
label
:name
,
class:
'control-label'
.col-sm-10
=
f
.
text_field
:name
,
class:
'form-control'
,
required:
true
=
f
.
label
:name
,
class:
'label-light'
=
f
.
text_field
:name
,
class:
'form-control'
,
required:
true
.form-group
=
f
.
label
:redirect_uri
,
class:
'control-label'
.col-sm-10
=
f
.
text_area
:redirect_uri
,
class:
'form-control'
,
required:
true
=
f
.
label
:redirect_uri
,
class:
'label-light'
=
f
.
text_area
:redirect_uri
,
class:
'form-control'
,
required:
true
%span
.help-block
Use one line per URI
-
if
Doorkeeper
.
configuration
.
native_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
Use
%code
=
Doorkeeper
.
configuration
.
native_redirect_uri
for local tests
.form-actions
=
f
.
submit
'Submit'
,
class:
"btn btn-create"
=
link_to
"Cancel"
,
applications_profile_path
,
class:
"btn btn-cancel"
.prepend-top-default
=
f
.
submit
'Save application'
,
class:
"btn btn-create"
app/views/doorkeeper/applications/index.html.haml
View file @
90e91e28
-
page_title
"Applications"
%h3
.page-title
Your applications
%p
=
link_to
'New Application'
,
new_oauth_application_path
,
class:
'btn btn-success'
-
header_title
page_title
,
applications_profile_path
.table-holder
%table
.table.table-striped
%thead
%tr
%th
Name
%th
Callback URL
%th
%th
%tbody
-
@applications
.
each
do
|
application
|
%tr
{
:id
=>
"application_#{application.id}"
}
%td
=
link_to
application
.
name
,
oauth_application_path
(
application
)
%td
=
application
.
redirect_uri
%td
=
link_to
'Edit'
,
edit_oauth_application_path
(
application
),
class:
'btn btn-link'
%td
=
render
'delete_form'
,
application:
application
.row.prepend-top-default
.col-lg-3.profile-settings-sidebar
%h4
.prepend-top-0
=
page_title
%p
-
if
user_oauth_applications?
Manage applications that can use GitLab as an OAuth provider,
and applications that you've authorized to use your account.
-
else
Manage applications that you've authorized to use your account.
.col-lg-9
-
if
user_oauth_applications?
%h5
.prepend-top-0
Add new application
=
render
'form'
,
application:
@application
%hr
-
if
user_oauth_applications?
.oauth-applications
%h5
Your applications (
#{
@applications
.
size
}
)
-
if
@applications
.
any?
.table-responsive
%table
.table
%thead
%tr
%th
Name
%th
Callback URL
%th
Clients
%th
.last-heading
%tbody
-
@applications
.
each
do
|
application
|
%tr
{
id:
"application_#{application.id}"
}
%td
=
link_to
application
.
name
,
oauth_application_path
(
application
)
%td
-
application
.
redirect_uri
.
split
.
each
do
|
uri
|
%div
=
uri
%td
=
application
.
access_tokens
.
count
%td
=
link_to
edit_oauth_application_path
(
application
),
class:
"btn btn-transparent append-right-5"
do
%span
.sr-only
Edit
=
icon
(
'pencil'
)
=
render
'delete_form'
,
application:
application
,
small:
true
-
else
.profile-settings-message.text-center
You don't have any applications
.oauth-authorized-applications.prepend-top-20.append-bottom-default
-
if
user_oauth_applications?
%h5
Authorized applications (
#{
@authorized_tokens
.
size
}
)
-
if
@authorized_tokens
.
any?
.table-responsive
%table
.table.table-striped
%thead
%tr
%th
Name
%th
Authorized At
%th
Scope
%th
%tbody
-
@authorized_apps
.
each
do
|
app
|
-
token
=
app
.
authorized_tokens
.
order
(
'created_at desc'
).
first
%tr
{
id:
"application_#{app.id}"
}
%td
=
app
.
name
%td
=
token
.
created_at
%td
=
token
.
scopes
%td
=
render
'delete_form'
,
application:
app
-
@authorized_anonymous_tokens
.
each
do
|
token
|
%tr
%td
Anonymous
%div
.help-block
%em
Authorization was granted by entering your username and password in the application.
%td
=
token
.
created_at
%td
=
token
.
scopes
%td
=
render
'delete_form'
,
token:
token
-
else
.profile-settings-message.text-center
You don't have any authorized applications
app/views/layouts/nav/_profile.html.haml
View file @
90e91e28
...
...
@@ -17,7 +17,7 @@
=
icon
(
'gear fw'
)
%span
Account
=
nav_link
(
path:
[
'profiles#applications'
,
'applications#edit'
,
'applications#show'
,
'applications#new'
,
'applications#create'
]
)
do
=
nav_link
(
controller:
'oauth/applications'
)
do
=
link_to
applications_profile_path
,
title:
'Applications'
do
=
icon
(
'cloud fw'
)
%span
...
...
app/views/profiles/applications.html.haml
deleted
100644 → 0
View file @
ea7d062f
-
page_title
"Applications"
-
header_title
page_title
,
applications_profile_path
.alert.alert-help.prepend-top-default
-
if
user_oauth_applications?
Manage applications that can use GitLab as an OAuth provider,
and applications that you've authorized to use your account.
-
else
Manage applications that you've authorized to use your account.
-
if
user_oauth_applications?
.oauth-applications
%h3
Your applications
.pull-right
=
link_to
'New Application'
,
new_oauth_application_path
,
class:
'btn btn-success'
-
if
@applications
.
any?
.table-holder
%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
,
oauth_application_path
(
application
)
%td
-
application
.
redirect_uri
.
split
.
each
do
|
uri
|
%div
=
uri
%td
=
application
.
access_tokens
.
count
%td
=
link_to
'Edit'
,
edit_oauth_application_path
(
application
),
class:
'btn btn-link btn-sm'
%td
=
render
'doorkeeper/applications/delete_form'
,
application:
application
.oauth-authorized-applications.prepend-top-20
-
if
user_oauth_applications?
%h3
Authorized applications
-
if
@authorized_tokens
.
any?
.table-holder
%table
.table.table-striped
%thead
%tr
%th
Name
%th
Authorized At
%th
Scope
%th
%tbody
-
@authorized_apps
.
each
do
|
app
|
-
token
=
app
.
authorized_tokens
.
order
(
'created_at desc'
).
first
%tr
{
:id
=>
"application_#{app.id}"
}
%td
=
app
.
name
%td
=
token
.
created_at
%td
=
token
.
scopes
%td
=
render
'doorkeeper/authorized_applications/delete_form'
,
application:
app
-
@authorized_anonymous_tokens
.
each
do
|
token
|
%tr
%td
Anonymous
%div
.help-block
%em
Authorization was granted by entering your username and password in the application.
%td
=
token
.
created_at
%td
=
token
.
scopes
%td
=
render
'doorkeeper/authorized_applications/delete_form'
,
token:
token
-
else
%p
.light
You don't have any authorized applications
config/routes.rb
View file @
90e91e28
...
...
@@ -295,7 +295,7 @@ Rails.application.routes.draw do
resource
:profile
,
only:
[
:show
,
:update
]
do
member
do
get
:audit_log
get
:applications
get
:applications
,
to:
'oauth/applications#index'
put
:reset_private_token
put
:update_username
...
...
features/profile/profile.feature
View file @
90e91e28
...
...
@@ -76,8 +76,7 @@ Feature: Profile
Scenario
:
I
can manage application
Given
I visit profile applications page
Then
I click on new application button
And
I should see application form
Then
I should see application form
Then
I fill application form out and submit
And
I see application
Then
I click edit
...
...
features/steps/profile/profile.rb
View file @
90e91e28
...
...
@@ -180,18 +180,14 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
end
step
'I click on new application button'
do
click_on
'New Application'
end
step
'I should see application form'
do
expect
(
page
).
to
have_content
"
New A
pplication"
expect
(
page
).
to
have_content
"
Add new a
pplication"
end
step
'I fill application form out and submit'
do
fill_in
:doorkeeper_application_name
,
with:
'test'
fill_in
:doorkeeper_application_redirect_uri
,
with:
'https://test.com'
click_on
"S
ubmit
"
click_on
"S
ave application
"
end
step
'I see application'
do
...
...
@@ -211,7 +207,7 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
step
'I change name of application and submit'
do
expect
(
page
).
to
have_content
"Edit application"
fill_in
:doorkeeper_application_name
,
with:
'test_changed'
click_on
"S
ubmit
"
click_on
"S
ave application
"
end
step
'I see that application was changed'
do
...
...
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