social_stream-oauth2_server 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/step_1.png +0 -0
  3. data/app/assets/images/step_2.png +0 -0
  4. data/app/assets/stylesheets/social_stream-oauth2_server.css.sass +2 -0
  5. data/app/assets/stylesheets/social_stream/oauth2_server/applications/_applications-oauth2server.css.sass +47 -32
  6. data/app/assets/stylesheets/social_stream/oauth2_server/create/layout/_create-oauth2server.css.sass +15 -1
  7. data/app/assets/stylesheets/social_stream/oauth2_server/mixins/_mixins.css.sass +5 -0
  8. data/app/assets/stylesheets/social_stream/oauth2_server/show/_show-oauth2server.css.sass +13 -16
  9. data/app/assets/stylesheets/social_stream/oauth2_server/show/layout/_show-oauth2server.css.sass +55 -34
  10. data/app/controllers/site/clients_controller.rb +18 -0
  11. data/app/decorators/social_stream/base/user_decorator.rb +17 -0
  12. data/app/decorators/social_stream/base/users_controller_decorator.rb +8 -0
  13. data/app/models/oauth2_token.rb +1 -1
  14. data/app/overrides/layouts/_header_dropdown_menu/applications_entry.html.erb.deface +1 -1
  15. data/app/views/site/clients/_form.html.erb +38 -38
  16. data/app/views/site/clients/_form_step1.html.erb +7 -0
  17. data/app/views/site/clients/_form_step2.html.erb +20 -0
  18. data/app/views/site/clients/_list.html.erb +24 -0
  19. data/app/views/site/clients/edit.html.erb +14 -0
  20. data/app/views/site/clients/index.html.erb +44 -27
  21. data/app/views/site/clients/new.html.erb +2 -2
  22. data/app/views/site/clients/show.html.erb +104 -42
  23. data/config/locales/en.yml +7 -0
  24. data/config/locales/es.yml +7 -0
  25. data/lib/social_stream/oauth2_server/token_endpoint.rb +23 -22
  26. data/lib/social_stream/oauth2_server/version.rb +1 -1
  27. data/social_stream-oauth2_server.gemspec +1 -1
  28. metadata +12 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 865501e44185f2dc43005b204a8fe933e9023c71
4
- data.tar.gz: e99b0ed5463fa634f9913fd4e6d688639a50026e
3
+ metadata.gz: e5874569601b0facde73388ee10a32044bc0bc6e
4
+ data.tar.gz: 96810fac87271a300f61ea2aa58fc68ef6577286
5
5
  SHA512:
6
- metadata.gz: 3d2bdaf781dfdaa2398fab06047951aa097e8b8598fec1fb8ce873e1e2b8ece122f191795f67a9b343900ef526663763c202047acd73a5634442225352444cb8
7
- data.tar.gz: cdde205d4c00a4451bc265d8c017c3f67289f4981ccc1a3a90fe6742daa5b97b6b49ac9dcf91248034b444163fc807f1a056cff751ac71c205502cd0f8993f09
6
+ metadata.gz: 9e81ba78877af6bb87b7a09ae819ad3788898e5aac3431a3ccf05938384cc0614d458e1e97c5369d6d07ac4358e4a320eac0439fc4caf7c4f8383c06de1632e5
7
+ data.tar.gz: 1219933a3ca94f0de905540b9b075cf2c009491250bd04875dd8fc89848b499055dd40ce54e67736fbb9099cb0a7f2675c797e2603bd2e2b8a8f2912498708b3
Binary file
Binary file
@@ -1,3 +1,5 @@
1
+ @import "social_stream/oauth2_server/mixins/mixins/"
2
+
1
3
  @import "social_stream/oauth2_server/applications/applications-oauth2server"
2
4
  @import "social_stream/oauth2_server/applications/layout/applications-oauth2server"
3
5
 
@@ -1,40 +1,39 @@
1
- #site_clients
2
- .site_clients
3
- header
4
- h1
5
- @include colorfont-big-size
6
- float: left
7
- a
8
- @include btn-primary
9
- @include border-radius(5px)
10
- margin: 12px 0
11
- .soften
12
- @include opacity (100)
13
-
14
- .name,
15
- .url,
16
- .users
17
- color: $gray
1
+ .site_clients
2
+ header
3
+ h1
4
+ @include colorfont-big-size
5
+ float: left
6
+ a
7
+ @include btn-primary
8
+ @include border-radius(5px)
9
+ margin: 12px 0
10
+ .soften
11
+ @include opacity (100)
18
12
 
19
- .name
20
- font-size: 16px
13
+ .name,
14
+ .url,
15
+ .users
16
+ color: $gray
21
17
 
22
- .url
23
- a
24
- color: $gray
25
- &:hover
26
- color: $blue
18
+ .name
19
+ font-size: 16px
27
20
 
28
- .users
29
- font-size: 16px
30
- span
21
+ .url
22
+ a
23
+ color: $gray
24
+ &:hover
31
25
  color: $blue
32
26
 
33
- #new_site_client-modal
34
- .modal-body
35
- input
36
- &[type="file"]
37
- line-height: 0px
27
+ .users
28
+ font-size: 16px
29
+ span
30
+ color: $blue
31
+
32
+ #new_site_client-modal
33
+ .modal-body
34
+ input
35
+ &[type="file"]
36
+ line-height: 0px
38
37
 
39
38
  .field_with_errors
40
39
  input
@@ -44,3 +43,19 @@
44
43
  #new_application
45
44
  .btn
46
45
  @include btn-primary
46
+
47
+
48
+ #site_client
49
+ margin-top: 48px
50
+ header
51
+ z-index: 100
52
+ margin-bottom: 0
53
+ h1
54
+ z-index: 50
55
+ position: absolute
56
+ margin-top: -47px
57
+ img
58
+ z-index: 100
59
+ margin: -47px 4px 0px 0px
60
+
61
+
@@ -2,6 +2,8 @@
2
2
  @include grid-core-span(10, $fluidGridColumnWidth, $fluidGridGutterWidth)
3
3
  float: left
4
4
  margin-left: 2.5%
5
+ img
6
+ width: 70%
5
7
  #content
6
8
  .box
7
9
  padding: 14px 20px 74px 20px
@@ -18,6 +20,18 @@
18
20
  height: 135px
19
21
  margin-top: -131px
20
22
 
21
-
23
+ #site_client_form
24
+ .description,
25
+ .url,
26
+ .callback_url
27
+ textarea
28
+ height: 20px
29
+ .description
30
+ textarea
31
+ height: 60px
32
+ input
33
+ &[type="submit"]
34
+ @include btn-primary
35
+ @include border-radius (5px)
22
36
 
23
37
 
@@ -0,0 +1,5 @@
1
+ @mixin principal-box
2
+ @include border-radius(5px)
3
+ @include box-shadow (1px 1px 15px 0px rgba(50, 50, 50, 0.1))
4
+ border: 1px solid
5
+ border-color: rgba(0,0,0, 0.1)
@@ -7,16 +7,16 @@
7
7
  color: #ccc
8
8
 
9
9
 
10
- #oauth2_server
10
+ #site_client
11
11
  h1
12
12
  text-align: left
13
- .content
14
- @include gradient-vertical($startColor: #ccc, $endColor: #f9f9f9)
15
- a
16
- img
17
- background-color: #f9f9f9
18
- .media
19
- .media-body
13
+ .site_client
14
+ @include principal-box
15
+ .content
16
+ a
17
+ img
18
+ background-color: #f9f9f9
19
+
20
20
  .name,
21
21
  .url,
22
22
  .users
@@ -28,10 +28,7 @@
28
28
  color: $gray
29
29
  &:hover
30
30
  color: $blue
31
- .result,
32
- .client_secret
33
- background-color: #f9f9f9
34
- @include border-radius(5px)
31
+ .result
35
32
  font-size: 15px
36
33
 
37
34
  .client_secret
@@ -39,7 +36,7 @@
39
36
  overflow-y: hidden
40
37
  overflow-x: scroll
41
38
 
42
- .users
43
- font-size: 16px
44
- span
45
- color: $blue
39
+ .users
40
+ font-size: 16px
41
+ span
42
+ color: $blue
@@ -29,43 +29,64 @@
29
29
  margin-right: 1px
30
30
 
31
31
 
32
- #oauth2_server
33
- width: 80%
32
+ #site_client
33
+ width: 75%
34
34
  margin-left: 2.85%
35
- display: inline-block
36
- h1
37
- @include clearfix
38
- margin-bottom: 4px
39
- .soften
40
- margin-bottom: 0px
41
- .content
42
- padding: 14px
43
- .media
44
- margin-top: 0
45
- .media-body
46
- margin-left: 2.85%
35
+ .site_client
36
+ width: 95%
37
+ padding-left: 2.5%
38
+ padding-right: 2.5%
39
+ display: inline-block
40
+ h1
41
+ @include clearfix
42
+ margin-bottom: 4px
43
+ margin-left: -2.5%
44
+ a
45
+ font-size: 13px
46
+ .soften
47
+ margin-bottom: 0px
48
+ .content
49
+ padding: 14px
47
50
  img
48
51
  display: inline
49
52
  @include size (40px, 40px)
50
- h4
51
- margin-bottom: 0px
52
- .name,
53
- .url,
54
- .users
55
- display: inline-block
56
- .name,
57
- .url
58
- margin-left: 20px
53
+ .gereral-info
54
+ @include grid-core-span(10, $fluidGridColumnWidth, $fluidGridGutterWidth)
55
+ float: left
56
+ margin-top: -50px
57
+ h4
58
+ margin-bottom: 0px
59
+ .name,
60
+ .url,
61
+ .users
62
+ display: inline-block
63
+ .name,
64
+ .url
65
+ margin-left: 20px
59
66
 
60
- .result,
61
- .client_secret
62
- padding: 7px
63
- margin-bottom: 20px
67
+ .result
68
+ margin-bottom: 18px
69
+ margin-left: 20px
70
+ padding-top: 5px
71
+ border-top: 1px solid #C1C1C1
72
+ .btn-group
73
+ @include btn-primary
74
+ @include border-radius(5px)
75
+ @include btn-add
76
+ .dropdown-menu
77
+ width: 300px
78
+ margin-left: -196px
79
+ li
80
+ word-break: break-all
81
+ overflow-y: hidden
82
+ overflow-x: scroll
83
+ h6
84
+ border-bottom: 1px solid #CCC
85
+ a
86
+ color: principalColor
64
87
 
65
- .client_secret
66
- height: 23px
67
- p
68
- width: 250%
69
- .users
70
- float: right
71
- margin-top: 7px
88
+
89
+
90
+ .users
91
+ float: right
92
+ margin-top: 7px
@@ -29,6 +29,24 @@ class Site::ClientsController < ApplicationController
29
29
  end
30
30
  end
31
31
 
32
+ def edit
33
+ @client = Site::Client.find params[:id]
34
+ end
35
+
36
+ def update
37
+ @client = Site::Client.find params[:id]
38
+
39
+ if @client.update_attributes params[:client]
40
+ respond_to do |format|
41
+ format.html { redirect_to @client }
42
+ end
43
+ else
44
+ respond_to do |format|
45
+ format.html { render :edit }
46
+ end
47
+ end
48
+ end
49
+
32
50
  private
33
51
 
34
52
  def set_author_ids
@@ -1,3 +1,20 @@
1
1
  User.class_eval do
2
2
  include SocialStream::Oauth2Server::Models::User
3
+
4
+ def as_json_with_client options = {}
5
+ hash = as_json_without_client options
6
+
7
+ if options[:client] && !options[:client].is_a?(User)
8
+ hash['roles'] = options[:client].contact_to!(self).relations.map{ |r|
9
+ {
10
+ id: r.id,
11
+ name: r.name
12
+ }
13
+ }
14
+ end
15
+
16
+ hash
17
+ end
18
+
19
+ alias_method_chain :as_json, :client
3
20
  end
@@ -0,0 +1,8 @@
1
+ UsersController.class_eval do
2
+ def current
3
+ binding.pry
4
+ respond_to do |format|
5
+ format.json { render json: current_user.to_json(client: oauth2_token.try(:client)) }
6
+ end
7
+ end
8
+ end
@@ -27,7 +27,7 @@ class Oauth2Token < ActiveRecord::Base
27
27
  protected
28
28
 
29
29
  def setup
30
- self.token = SecureRandom.base64(64)
30
+ self.token = SecureRandom.urlsafe_base64(64)
31
31
  self.expires_at ||= default_lifetime.from_now
32
32
  end
33
33
  end
@@ -1,4 +1,4 @@
1
1
  <!-- insert_after "code[erb-loud]:contains('header_dropdown_menu_sessions')" -->
2
- <li>
2
+ <li class="applications-menu">
3
3
  <%= link_to t('account.applications'), site_clients_path %>
4
4
  </li>
@@ -1,39 +1,39 @@
1
- <article class="new_app">
2
- <%= form_for(@client || Site::Client.new) do |f| %>
3
-
4
- <% if f.object.errors.any? %>
5
- <div id="error_explanation" class="alert alert-error">
6
- <h2><%= pluralize(f.object.errors.count, "error") %> prohibited this client site from being saved:</h2>
7
-
8
- <ul>
9
- <% f.object.errors.full_messages.each do |msg| %>
10
- <li><%= msg %></li>
11
- <% end %>
12
- </ul>
13
-
14
- </div>
15
- <% end %>
16
- <article id="new_application">
17
- <section class="name">
18
- <%= f.label :name %>
19
- <%= f.text_field :name %>
20
- </section>
21
-
22
- <section class="description">
23
- <%= f.label :description %>
24
- <%= f.text_area :description %>
25
- </section>
26
-
27
- <section class="url">
28
- <%= f.label :url %>
29
- <%= f.text_area :url %>
30
- </section>
31
-
32
- <section class="callback_url">
33
- <%= f.label :callback_url %>
34
- <%= f.text_area :callback_url %>
35
- </section>
36
- <%= f.submit :class => "btn pull-right" %>
37
- </article>
1
+ <%= form_for(@client || Site::Client.new) do |f| %>
2
+
3
+ <% if f.object.errors.any? %>
4
+ <div id="error_explanation" class="alert alert-error">
5
+ <h2><%= pluralize(f.object.errors.count, "error") %> prohibited this client site from being saved:</h2>
6
+
7
+ <ul>
8
+ <% f.object.errors.full_messages.each do |msg| %>
9
+ <li><%= msg %></li>
10
+ <% end %>
11
+ </ul>
12
+
13
+ </div>
38
14
  <% end %>
39
- </article>
15
+
16
+ <section id="site_client_form">
17
+ <section class="name">
18
+ <%= f.label :name %>
19
+ <%= f.text_field :name %>
20
+ </section>
21
+
22
+ <section class="description">
23
+ <%= f.label :description %>
24
+ <%= f.text_area :description %>
25
+ </section>
26
+
27
+ <section class="url">
28
+ <%= f.label :url %>
29
+ <%= f.text_area :url %>
30
+ </section>
31
+
32
+ <section class="callback_url">
33
+ <%= f.label :callback_url %>
34
+ <%= f.text_area :callback_url %>
35
+ </section>
36
+
37
+ <%= f.submit %>
38
+ </section>
39
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <%= image_tag 'step_1.png' %>
2
+
3
+ <article class="new_app">
4
+ <%= render partial: 'form' %>
5
+ </article>
6
+
7
+
@@ -0,0 +1,20 @@
1
+ <img src="/assets/step_2.png">
2
+ <article class="permissions">
3
+ <h4>
4
+ <%= raw t('permission.of_relation.choose', :name => h(@relation.name)) %>
5
+ </h4>
6
+
7
+ <%= form_for @relation, url: polymorphic_path(@relation, section: 'permissions'), remote: true do |f| %>
8
+ <%= hidden_field_tag 'relation_custom[permission_ids][]', "" %>
9
+
10
+ <ul>
11
+ <% default_permissions.each do |p| %>
12
+ <li>
13
+ <%= check_box_tag 'relation_custom[permission_ids][]', p.id, @relation.permission_ids.include?(p.id), id: "checkbox_relation_#{ @relation.id }_permission_#{ p.id }" %>
14
+ <%= label_tag "checkbox_relation_#{ @relation.id }_permission_#{ p.id }", p.description(:brief, subject: current_subject), title: p.description(:detailed, subject: current_subject, state: (@relation.permission_ids.include?(p.id) ? 'positive' : 'negative'), relation: @relation.name) %>
15
+ </li>
16
+ <% end %>
17
+ </ul>
18
+ <% end %>
19
+ <%= f.submit :next %>
20
+ </article>
@@ -0,0 +1,24 @@
1
+ <section class="site_clients_list">
2
+ <% list.each do |client| %>
3
+
4
+ <%= image_tag client.logo.url(:small), style: "width: 40px; height: 40px;" %>
5
+
6
+ <div class="name">
7
+ <%= link_to client.name, client %>
8
+ </div>
9
+ <div class="url">
10
+ <%= link_to client.url, client.url, target: '_blank' %>
11
+ </div>
12
+ <div class="users">
13
+ <span>
14
+ 5
15
+ </span>
16
+ users
17
+ </div>
18
+ <hr class="soften">
19
+ <% end %>
20
+
21
+ <%= javascript_tag do %>
22
+ SocialStream.SiteClient.index();
23
+ <% end %>
24
+ </section>
@@ -0,0 +1,14 @@
1
+ <section id="edit_site_client">
2
+
3
+ <%= render partial: 'toolbar/home' %>
4
+
5
+ <section class="edit_site_client" id="edit_<%= dom_id @client %>">
6
+ <%= render partial: 'form' %>
7
+
8
+ <section class="site_client_roles">
9
+ <%= render partial: 'relation/customs/index',
10
+ locals: { list: @client.relations } %>
11
+ </section>
12
+ </section>
13
+ </section>
14
+
@@ -1,42 +1,59 @@
1
1
  <section id="site_clients" class="first-img">
2
2
 
3
- <%= render partial: 'toolbar/home' %>
3
+ <%= render partial: 'toolbar/home' %>
4
4
 
5
5
  <section class="site_clients">
6
6
  <header>
7
- <h1 class="colorfont">
7
+ <h3>
8
+ <%= link_to t('site.client.new.link'), new_site_client_path, class: "new_site_client-modal-link", 'data-toggle' => 'modal' %>
9
+
8
10
  <%= t 'site.client.added' %>
9
- </h1>
10
-
11
- <%= link_to t('site.client.new.link'), new_site_client_path, class: "new_site_client-modal-link", 'data-toggle' => 'modal' %>
12
-
13
- <%= render partial: 'new.modal' %>
14
-
15
- <hr class="soften">
11
+ </h3>
16
12
  </header>
13
+ <div class="tabbable"> <!-- Only required for left/right tabs -->
14
+ <ul class="nav nav-tabs">
15
+ <li class="active"><a href="#tab1" data-toggle="tab">Mine</a></li>
16
+ <li><a href="#tab2" data-toggle="tab">Others</a></li>
17
+ </ul>
18
+ <div class="search-nav hidden-phone">
19
+ <%= form_tag search_path, method: 'get', class: "navbar-search pull-left" do %>
20
+ <%= text_field_tag :q, nil, autocomplete: :off, class: 'search-query input-small', placeholder: t('search.name'), "data-min_query" => SocialStream::Search::MIN_QUERY %>
21
+ <% end %>
22
+ <%= javascript_tag do %>
23
+ $(function() {
24
+ SocialStream.SearchHeader.show();
25
+ });
26
+ <% end %>
27
+ <div class="mat">
28
+ <%= render partial: 'layouts/loading' %>
29
+
30
+ <div class="query_too_short">
31
+ <%= t 'search.at_least', count: SocialStream::Search::MIN_QUERY %>
32
+ </div>
33
+
34
+ <div class="no_results">
35
+ <%= t 'search.nothing' %>
36
+ </div>
37
+
38
+ <div class="results">
39
+ </div>
40
+ </div>
41
+ </div>
17
42
 
18
- <% @developer_clients.each do |client| %>
19
43
 
20
- <%= image_tag client.logo.url(:small), style: "width: 40px; height: 40px;" %>
44
+ <div class="tab-content">
45
+ <div class="tab-pane active" id="tab1">
46
+ <%= render partial: 'list',
47
+ object: @developer_clients %>
48
+ </div>
21
49
 
22
- <div class="name">
23
- <%= link_to client.name, client %>
50
+ <div class="tab-pane" id="tab2">
51
+ </div>
24
52
  </div>
25
- <div class="url">
26
- <%= link_to client.url, client.url, target: '_blank' %>
27
- </div>
28
- <div class="users">
29
- <span>
30
- 5
31
- </span>
32
- users
33
- </div>
34
- <hr class="soften">
35
- <% end %>
53
+ </div>
36
54
 
37
- <%= javascript_tag do %>
38
- SocialStream.SiteClient.index();
39
- <% end %>
55
+ <%= render partial: 'new.modal' %>
40
56
 
57
+ <hr class="soften">
41
58
  </section>
42
59
  </section>
@@ -2,9 +2,9 @@
2
2
  <%= render partial: 'toolbar/home' %>
3
3
 
4
4
  <section class="new_site_client">
5
- <h1><%= t 'site.client.new.title' %></h1>
6
5
 
7
- <%= render partial: 'form' %>
6
+
7
+ <%= render partial: 'form_step1' %>
8
8
  </section>
9
9
  </section>
10
10
 
@@ -1,52 +1,114 @@
1
- <div class="oauth2_server">
1
+ <section id="site_client">
2
2
  <%= render partial: 'toolbar/home' %>
3
3
 
4
- <section id="oauth2_server">
5
- <h1>
6
- <%= @client.name %>
7
- </h1>
8
- <a class="pull-right" href="#">
9
- ir a tus demás aplicaciones
10
- </a>
11
- <hr class="soften">
12
- <div class="content">
13
- <a class="pull-left" href="#">
4
+ <section class="site_client" id="<%= dom_id @client %>">
5
+ <header>
6
+ <h1>
7
+ <%= @client.name %>
8
+ <a class="go-more" href="#">
9
+ ir a tus demás aplicaciones
10
+ </a>
11
+ </h1>
12
+
13
+ <%= image_tag('logos/app-default.png', class: "logo-app pull-right") %>
14
+
15
+ </header>
14
16
 
15
- <%= image_tag('logos/app-default.png', class: "media-object") %>
17
+ <div class="content">
18
+ <div class="gereral-info">
19
+ <h4>
20
+ <%= Site::Client.human_attribute_name :description %>
21
+ </h4>
22
+ <div class="result">
23
+ <%= link_to @client.description, @client.description%>
24
+ </div>
16
25
 
26
+ <h4>
27
+ <%= Site::Client.human_attribute_name :url %>
28
+ </h4>
29
+ <div class="result">
30
+ <%= link_to @client.url, @client.url%>
31
+ </div>
17
32
 
33
+ <h4>
34
+ <%= Site::Client.human_attribute_name :callback_url %>
35
+ </h4>
36
+ <div class="result">
37
+ <%= @client.callback_url %>
38
+ </div>
39
+ </div>
18
40
 
19
- </a>
20
- <article class="media box">
21
- <div class="media-body">
22
- <h4>
23
- <%= Site::Client.human_attribute_name :url %>
24
- </h4>
25
- <div class="result">
26
- <%= link_to @client.url, @client.url%>
27
- </div>
28
- <h4>
29
- <%= Site::Client.human_attribute_name :callback_url %>
30
- </h4>
31
- <div class="result">
32
- <%= @client.callback_url %>
33
- </div>
34
- <h4>
41
+ <div class="btn-group">
42
+ <a class="dropdown-toggle" data-toggle="dropdown" href="#">
43
+ Credentials
44
+ <span class="caret"></span>
45
+ </a>
46
+ <ul class="dropdown-menu">
47
+ <li>
48
+ <h6>
35
49
  <%= Site::Client.human_attribute_name :id %>
36
- </h4>
37
- <div class="result">
50
+ <a href="#" class="pull-right">refresh</a>
51
+ </h6>
38
52
  <%= @client.id %>
39
- </div>
40
- <h4>
41
- <%= Site::Client.human_attribute_name :secret %>
42
- </h4>
43
- <div class="result client_secret">
44
- <p>
45
- <%= @client.secret %>
46
- </p>
47
- </div>
48
- </div>
49
- </article>
53
+ </li>
54
+
55
+ <li>
56
+ <h6>
57
+ <%= Site::Client.human_attribute_name :secret %>
58
+ <a href="#" class="pull-right">refresh</a>
59
+ </h6>
60
+ <%= @client.secret %>
61
+ </li>
62
+ </ul>
63
+ </div>
50
64
  </div>
51
65
  </section>
52
- </div>
66
+
67
+ <div class="tabbable"> <!-- Only required for left/right tabs -->
68
+ <ul class="nav nav-tabs">
69
+ <li class="active"><a href="#tab1" data-toggle="tab">Users</a></li>
70
+ <li><a href="#tab2" data-toggle="tab">Organizations</a></li>
71
+ <li><a href="#tab3" data-toggle="tab">Stats</a></li>
72
+ </ul>
73
+ <div class="search-nav hidden-phone">
74
+ <%= form_tag search_path, method: 'get', class: "navbar-search pull-left" do %>
75
+ <%= text_field_tag :q, nil, autocomplete: :off, class: 'search-query input-small', placeholder: t('search.name'), "data-min_query" => SocialStream::Search::MIN_QUERY %>
76
+ <% end %>
77
+ <%= javascript_tag do %>
78
+ $(function() {
79
+ SocialStream.SearchHeader.show();
80
+ });
81
+ <% end %>
82
+ <div class="mat">
83
+ <%= render partial: 'layouts/loading' %>
84
+
85
+ <div class="query_too_short">
86
+ <%= t 'search.at_least', count: SocialStream::Search::MIN_QUERY %>
87
+ </div>
88
+
89
+ <div class="no_results">
90
+ <%= t 'search.nothing' %>
91
+ </div>
92
+
93
+ <div class="results">
94
+ </div>
95
+ </div>
96
+ </div>
97
+
98
+
99
+ <div class="tab-content">
100
+ <div class="tab-pane active" id="tab1">
101
+ <ul class="nav nav-pills">
102
+ <li class="active">
103
+ <a href="#">added</a>
104
+ </li>
105
+ <li><a href="#">registered</a></li>
106
+ </ul>
107
+ </div>
108
+
109
+ <div class="tab-pane" id="tab2">
110
+ </div>
111
+ </div>
112
+ </div>
113
+
114
+ </section>
@@ -18,8 +18,15 @@ en:
18
18
  title: Authorize %{client}?
19
19
  permission:
20
20
  title: 'The site %{client} will be able to:'
21
+ helpers:
22
+ submit:
23
+ site_client:
24
+ create: "Next"
25
+ update: "Save"
21
26
  permission:
22
27
  public_info: Read your public information
28
+ relation_admin:
29
+ name: "Site Client Admin"
23
30
  site:
24
31
  client:
25
32
  added: Added sites
@@ -10,8 +10,15 @@ es:
10
10
  name: Nombre
11
11
  secret: Client Secret
12
12
  url: URL
13
+ helpers:
14
+ submit:
15
+ site_client:
16
+ create: "Siguiente"
17
+ update: "Guardar"
13
18
  permission:
14
19
  public_info: Acceder a tu información pública
20
+ relation_admin:
21
+ name: "Administrador de Sitio"
15
22
  site:
16
23
  client:
17
24
  added: Sitios añadidos
@@ -9,30 +9,31 @@ module SocialStream
9
9
 
10
10
  def authenticator
11
11
  Rack::OAuth2::Server::Token.new do |req, res|
12
- client = Site::Client.find(req.client_id) || req.invalid_client!
13
- client.secret == req.client_secret || req.invalid_client!
12
+ client = Site::Client.find(req.client_id) || req.invalid_client!
13
+ client.secret == req.client_secret || req.invalid_client!
14
14
 
15
- case req.grant_type
16
- when :authorization_code
17
- code = Oauth2Token::AuthorizationCode.valid.find_by_token(req.code)
18
- req.invalid_grant! if code.blank? || code.redirect_uri != req.redirect_uri
15
+ case req.grant_type
16
+ when :authorization_code
17
+ code = Oauth2Token::AuthorizationCode.valid.find_by_token(req.code)
18
+ req.invalid_grant! if code.blank? || code.redirect_uri != req.redirect_uri
19
19
 
20
- res.access_token = code.access_token.to_bearer_token(:with_refresh_token)
21
- when :password
22
- # TODO
23
- account = Account.find_by_username_and_password(req.username, req.password) || req.invalid_grant!
24
- res.access_token = account.access_tokens.create(:client => client).to_bearer_token(:with_refresh_token)
25
- when :client_credentials
26
- # NOTE: client is already authenticated here.
27
- res.access_token = client.access_tokens.create!.to_bearer_token
28
- when :refresh_token
29
- refresh_token = client.refresh_tokens.valid.find_by_token(req.refresh_token)
30
- req.invalid_grant! unless refresh_token
31
- res.access_token = refresh_token.access_tokens.create!.to_bearer_token
32
- else
33
- # NOTE: extended assertion grant_types are not supported yet.
34
- req.unsupported_grant_type!
35
- end
20
+ res.access_token = code.access_token.to_bearer_token(:with_refresh_token)
21
+ when :password
22
+ user = User.find_for_authentication(email: req.username) || req.invalid_grant!
23
+ user.valid_password?(req.password) || req.invalid_grant!
24
+
25
+ res.access_token = user.access_tokens.create(:client => client).to_bearer_token(:with_refresh_token)
26
+ when :client_credentials
27
+ # NOTE: client is already authenticated here.
28
+ res.access_token = client.access_tokens.create!.to_bearer_token
29
+ when :refresh_token
30
+ refresh_token = client.refresh_tokens.valid.find_by_token(req.refresh_token)
31
+ req.invalid_grant! unless refresh_token
32
+ res.access_token = refresh_token.access_tokens.create!.to_bearer_token
33
+ else
34
+ # NOTE: extended assertion grant_types are not supported yet.
35
+ req.unsupported_grant_type!
36
+ end
36
37
  end
37
38
  end
38
39
  end
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Oauth2Server
3
- VERSION = "2.0.2".freeze
3
+ VERSION = "2.0.3".freeze
4
4
  end
5
5
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.files = `git ls-files`.split("\n")
13
13
 
14
14
  # Gem dependencies
15
- s.add_runtime_dependency('social_stream-base', '~> 2.0.3')
15
+ s.add_runtime_dependency('social_stream-base', '~> 2.0.4')
16
16
  s.add_runtime_dependency('rack-oauth2', '~> 1.0.0')
17
17
 
18
18
  s.add_development_dependency('rspec-rails', '~> 2.8.0')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_stream-oauth2_server
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antonio Tapiador
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-03 00:00:00.000000000 Z
12
+ date: 2013-06-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: social_stream-base
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ~>
19
19
  - !ruby/object:Gem::Version
20
- version: 2.0.3
20
+ version: 2.0.4
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ~>
26
26
  - !ruby/object:Gem::Version
27
- version: 2.0.3
27
+ version: 2.0.4
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rack-oauth2
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -68,6 +68,8 @@ files:
68
68
  - Rakefile
69
69
  - app/assets/images/logos/app-default.png
70
70
  - app/assets/images/logos/small/site.png
71
+ - app/assets/images/step_1.png
72
+ - app/assets/images/step_2.png
71
73
  - app/assets/javascripts/social_stream-oauth2_server.js
72
74
  - app/assets/javascripts/social_stream/site_client.js
73
75
  - app/assets/stylesheets/social_stream-oauth2_server.css.sass
@@ -82,6 +84,7 @@ files:
82
84
  - app/assets/stylesheets/social_stream/oauth2_server/create/responsive/_responsive-1200px-min.css.sass
83
85
  - app/assets/stylesheets/social_stream/oauth2_server/create/responsive/_responsive-767px-max.css.sass
84
86
  - app/assets/stylesheets/social_stream/oauth2_server/create/responsive/_responsive-768px-979px.css.sass
87
+ - app/assets/stylesheets/social_stream/oauth2_server/mixins/_mixins.css.sass
85
88
  - app/assets/stylesheets/social_stream/oauth2_server/show/_show-oauth2server.css.sass
86
89
  - app/assets/stylesheets/social_stream/oauth2_server/show/layout/_show-oauth2server.css.sass
87
90
  - app/assets/stylesheets/social_stream/oauth2_server/show/responsive/_responsive-1200px-min.css.sass
@@ -91,6 +94,7 @@ files:
91
94
  - app/controllers/site/clients_controller.rb
92
95
  - app/decorators/social_stream/base/actor_decorator.rb
93
96
  - app/decorators/social_stream/base/user_decorator.rb
97
+ - app/decorators/social_stream/base/users_controller_decorator.rb
94
98
  - app/helpers/site_client_helper.rb
95
99
  - app/models/oauth2_token.rb
96
100
  - app/models/oauth2_token/access_token.rb
@@ -104,8 +108,12 @@ files:
104
108
  - app/views/authorizations/error.html.erb
105
109
  - app/views/authorizations/new.html.erb
106
110
  - app/views/site/clients/_form.html.erb
111
+ - app/views/site/clients/_form_step1.html.erb
112
+ - app/views/site/clients/_form_step2.html.erb
113
+ - app/views/site/clients/_list.html.erb
107
114
  - app/views/site/clients/_new.modal.html.erb
108
115
  - app/views/site/clients/_presentation.html.erb
116
+ - app/views/site/clients/edit.html.erb
109
117
  - app/views/site/clients/index.html.erb
110
118
  - app/views/site/clients/new.html.erb
111
119
  - app/views/site/clients/show.html.erb