Skip to content
This repository has been archived by the owner on Sep 18, 2020. It is now read-only.

Commit

Permalink
Merge pull request #33 from texasjusticar/master
Browse files Browse the repository at this point in the history
Visibility into total applications configured with Opro
  • Loading branch information
schneems committed Feb 7, 2014
2 parents fdd96d0 + e0e22d8 commit 9fbd0bb
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ That should be all you need to do to get set up. Congrats, you're now able to au

oPRO comes with built in documentation, so if you start your server you can view the docs at [http://localhost:3000/oauth_docs](http://localhost:3000/oauth_docs). Or you can [view the guide](http://opro-demo.herokuapp.com/oauth_docs) on the example app. This guide will walk you through creating your first OAuth client application, giving access to that app as a logged in user, getting an access token for that user, and using that token to access the server as an authenticated user!

Keep in mind that the OAuth client application is associated to the user creating it. If you have multiple administrators for oPRO, be aware that the web interface is currently only useful to the user that created it.


# Advanced Setup

Expand Down
1 change: 1 addition & 0 deletions app/controllers/opro/oauth/client_app_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def new
# Show all client applications belonging to the current user
def index
@client_apps = Opro::Oauth::ClientApp.where(user_id: current_user.id)
@all_apps_count = Opro::Oauth::ClientApp.count
end

def show
Expand Down
3 changes: 3 additions & 0 deletions app/views/opro/oauth/client_app/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<div class="opro">
<%- if @client_apps.blank? -%>
<h2>You have no applications.</h2>
<%- if @all_apps_count > 0 %>
<h3>Maybe you created an application under a different user account?</h3>
<%- end -%>
<%- else -%>
<h2>Your Applications</h2>
<% @client_apps.each do |client_app| %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/opro/oauth/docs/markdown/quick_start.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Sign in as a registered user then visit the [new client application page](<%= ne
Secret: 14321myClientSecret8765


Once you've registered an app successfully we can start to build an OAuth application. Don't continue until you've [registered a client app](<%= new_oauth_client_app_path %>).
Once you've registered an app successfully we can start to build an OAuth application. Don't continue until you've [registered a client app](<%= new_oauth_client_app_path %>). Also be aware that the client app is associated to the user that created it for purposes of administration.


## Step 2: As a user, grant access to your app
Expand Down
13 changes: 13 additions & 0 deletions test/integration/client_app_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ class ClientAppControllerTest < ActiveSupport::IntegrationCase

as_user(app.user).visit oauth_client_apps_path
assert_equal oauth_client_apps_path, current_path
assert !has_content?("Maybe you created an application under a different user account?")
end

test 'index client applications for other users' do
app = create_client_app
create_client_app(:user => app.user)
create_client_app(:user => app.user)

another_user = create_user

as_user(another_user).visit oauth_client_apps_path
assert has_content?("You have no applications.")
assert has_content?("Maybe you created an application under a different user account?")
end

test 'delete existing client application' do
Expand Down

0 comments on commit 9fbd0bb

Please sign in to comment.