doorkeeper 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of doorkeeper might be problematic. Click here for more details.

Files changed (35) hide show
  1. data/README.md +42 -14
  2. data/Rakefile +1 -1
  3. data/app/assets/stylesheets/doorkeeper/application.css +4 -0
  4. data/app/controllers/doorkeeper/application_controller.rb +2 -2
  5. data/app/controllers/doorkeeper/application_controller.rbc +32 -20
  6. data/app/controllers/doorkeeper/authorizations_controller.rbc +86 -22
  7. data/app/controllers/doorkeeper/authorized_applications_controller.rb +13 -0
  8. data/app/controllers/doorkeeper/authorized_applications_controller.rbc +393 -0
  9. data/app/controllers/doorkeeper/tokens_controller.rb +4 -0
  10. data/app/models/access_grant.rb +8 -0
  11. data/app/models/access_grant.rbc +204 -39
  12. data/app/models/access_token.rb +31 -3
  13. data/app/models/access_token.rbc +270 -72
  14. data/app/models/application.rb +8 -1
  15. data/app/models/application.rbc +307 -61
  16. data/app/views/doorkeeper/authorizations/new.html.erb +17 -0
  17. data/app/views/doorkeeper/authorized_applications/index.html.erb +26 -0
  18. data/config/routes.rb +1 -0
  19. data/config/routes.rbc +48 -4
  20. data/lib/doorkeeper/config.rb +82 -22
  21. data/lib/doorkeeper/config.rbc +739 -295
  22. data/lib/doorkeeper/config/scope.rb +11 -0
  23. data/lib/doorkeeper/config/scopes.rb +57 -0
  24. data/lib/doorkeeper/config/scopes_builder.rb +18 -0
  25. data/lib/doorkeeper/doorkeeper_for.rb +96 -16
  26. data/lib/doorkeeper/oauth/access_token_request.rb +57 -18
  27. data/lib/doorkeeper/oauth/access_token_request.rbc +256 -67
  28. data/lib/doorkeeper/oauth/authorization_request.rb +31 -4
  29. data/lib/doorkeeper/oauth/authorization_request.rbc +230 -65
  30. data/lib/doorkeeper/version.rb +1 -1
  31. data/lib/doorkeeper/version.rbc +1 -1
  32. data/lib/generators/doorkeeper/templates/README +3 -0
  33. data/lib/generators/doorkeeper/templates/initializer.rb +13 -0
  34. data/lib/generators/doorkeeper/templates/migration.rb +4 -1
  35. metadata +35 -18
@@ -1,14 +1,21 @@
1
1
  class Application < ActiveRecord::Base
2
2
  include Doorkeeper::OAuth::RandomString
3
- set_table_name 'oauth_applications'
3
+
4
+ set_table_name :oauth_applications
4
5
 
5
6
  has_many :access_grants
7
+ has_many :authorized_tokens, :class_name => "AccessToken", :conditions => { :revoked_at => nil }
8
+ has_many :authorized_applications, :through => :authorized_tokens, :source => :application
6
9
 
7
10
  validates :name, :secret, :redirect_uri, :presence => true
8
11
  validates :uid, :presence => true, :uniqueness => true
9
12
 
10
13
  before_validation :generate_uid, :generate_secret, :on => :create
11
14
 
15
+ def self.authorized_for(resource_owner)
16
+ joins(:authorized_applications).where(:oauth_access_tokens => { :resource_owner_id => resource_owner.id })
17
+ end
18
+
12
19
  private
13
20
  def generate_uid
14
21
  self.uid = unique_random_string_for(:uid)
@@ -78,7 +78,7 @@ x
78
78
  11
79
79
  Application
80
80
  i
81
- 148
81
+ 238
82
82
  5
83
83
  66
84
84
  5
@@ -97,7 +97,6 @@ i
97
97
  5
98
98
  7
99
99
  5
100
- 64
101
100
  47
102
101
  49
103
102
  6
@@ -114,121 +113,212 @@ i
114
113
  5
115
114
  7
116
115
  9
117
- 7
116
+ 44
117
+ 43
118
118
  10
119
- 7
119
+ 80
120
+ 49
120
121
  11
122
+ 1
123
+ 13
124
+ 7
125
+ 12
126
+ 7
127
+ 13
128
+ 64
129
+ 49
130
+ 14
131
+ 2
132
+ 15
133
+ 13
134
+ 7
135
+ 15
121
136
  44
122
137
  43
123
- 12
138
+ 10
124
139
  79
125
140
  49
126
- 13
141
+ 11
127
142
  1
128
143
  13
129
144
  7
145
+ 16
146
+ 1
147
+ 49
130
148
  14
131
149
  2
132
- 49
133
150
  15
151
+ 49
152
+ 14
134
153
  2
135
154
  15
136
155
  47
137
156
  49
138
- 16
139
- 4
157
+ 8
158
+ 2
140
159
  15
141
160
  5
142
161
  7
143
162
  17
144
163
  44
145
164
  43
146
- 12
165
+ 10
147
166
  80
148
167
  49
149
- 13
168
+ 11
150
169
  1
151
170
  13
152
171
  7
172
+ 18
173
+ 7
174
+ 9
175
+ 49
153
176
  14
154
177
  2
178
+ 15
179
+ 13
180
+ 7
181
+ 19
182
+ 7
183
+ 20
155
184
  49
185
+ 14
186
+ 2
156
187
  15
188
+ 47
189
+ 49
190
+ 8
157
191
  2
158
192
  15
193
+ 5
194
+ 7
195
+ 21
196
+ 7
197
+ 22
198
+ 7
199
+ 23
200
+ 44
201
+ 43
202
+ 10
203
+ 79
204
+ 49
205
+ 11
206
+ 1
159
207
  13
160
208
  7
161
- 18
209
+ 24
162
210
  2
163
211
  49
212
+ 14
213
+ 2
164
214
  15
215
+ 47
216
+ 49
217
+ 25
218
+ 4
219
+ 15
220
+ 5
221
+ 7
222
+ 26
223
+ 44
224
+ 43
225
+ 10
226
+ 80
227
+ 49
228
+ 11
229
+ 1
230
+ 13
231
+ 7
232
+ 24
233
+ 2
234
+ 49
235
+ 14
236
+ 2
237
+ 15
238
+ 13
239
+ 7
240
+ 27
241
+ 2
242
+ 49
243
+ 14
165
244
  2
166
245
  15
167
246
  47
168
247
  49
169
- 16
248
+ 25
170
249
  2
171
250
  15
172
251
  5
173
252
  7
174
- 19
253
+ 28
175
254
  7
176
- 20
255
+ 29
177
256
  44
178
257
  43
179
- 12
258
+ 10
180
259
  79
181
260
  49
182
- 13
261
+ 11
183
262
  1
184
263
  13
185
264
  7
186
- 21
265
+ 30
187
266
  7
188
- 22
267
+ 31
189
268
  49
190
- 15
269
+ 14
191
270
  2
192
271
  15
193
272
  47
194
273
  49
195
- 23
274
+ 32
196
275
  3
197
276
  15
277
+ 99
278
+ 7
279
+ 33
280
+ 7
281
+ 34
282
+ 65
283
+ 5
284
+ 49
285
+ 35
286
+ 4
287
+ 15
198
288
  5
199
289
  48
200
- 24
290
+ 36
201
291
  15
202
292
  99
203
293
  7
204
- 19
294
+ 28
205
295
  7
206
- 25
296
+ 37
207
297
  65
208
298
  67
209
299
  49
210
- 26
300
+ 38
211
301
  0
212
302
  49
213
- 27
303
+ 39
214
304
  4
215
305
  15
216
306
  99
217
307
  7
218
- 20
308
+ 29
219
309
  7
220
- 28
310
+ 40
221
311
  65
222
312
  67
223
313
  49
224
- 26
314
+ 38
225
315
  0
226
316
  49
227
- 27
317
+ 39
228
318
  4
229
319
  11
230
320
  I
231
- 8
321
+ 9
232
322
  I
233
323
  0
234
324
  I
@@ -237,7 +327,7 @@ I
237
327
  0
238
328
  n
239
329
  p
240
- 29
330
+ 41
241
331
  x
242
332
  10
243
333
  Doorkeeper
@@ -251,7 +341,7 @@ RandomString
251
341
  x
252
342
  7
253
343
  include
254
- s
344
+ x
255
345
  18
256
346
  oauth_applications
257
347
  x
@@ -264,6 +354,42 @@ x
264
354
  8
265
355
  has_many
266
356
  x
357
+ 17
358
+ authorized_tokens
359
+ x
360
+ 4
361
+ Hash
362
+ x
363
+ 16
364
+ new_from_literal
365
+ x
366
+ 10
367
+ class_name
368
+ s
369
+ 11
370
+ AccessToken
371
+ x
372
+ 3
373
+ []=
374
+ x
375
+ 10
376
+ conditions
377
+ x
378
+ 10
379
+ revoked_at
380
+ x
381
+ 23
382
+ authorized_applications
383
+ x
384
+ 7
385
+ through
386
+ x
387
+ 6
388
+ source
389
+ x
390
+ 11
391
+ application
392
+ x
267
393
  4
268
394
  name
269
395
  x
@@ -273,18 +399,9 @@ x
273
399
  12
274
400
  redirect_uri
275
401
  x
276
- 4
277
- Hash
278
- x
279
- 16
280
- new_from_literal
281
- x
282
402
  8
283
403
  presence
284
404
  x
285
- 3
286
- []=
287
- x
288
405
  9
289
406
  validates
290
407
  x
@@ -309,6 +426,123 @@ x
309
426
  17
310
427
  before_validation
311
428
  x
429
+ 14
430
+ authorized_for
431
+ M
432
+ 1
433
+ n
434
+ n
435
+ x
436
+ 14
437
+ authorized_for
438
+ i
439
+ 44
440
+ 5
441
+ 7
442
+ 0
443
+ 47
444
+ 49
445
+ 1
446
+ 1
447
+ 44
448
+ 43
449
+ 2
450
+ 79
451
+ 49
452
+ 3
453
+ 1
454
+ 13
455
+ 7
456
+ 4
457
+ 44
458
+ 43
459
+ 2
460
+ 79
461
+ 49
462
+ 3
463
+ 1
464
+ 13
465
+ 7
466
+ 5
467
+ 20
468
+ 0
469
+ 49
470
+ 6
471
+ 0
472
+ 49
473
+ 7
474
+ 2
475
+ 15
476
+ 49
477
+ 7
478
+ 2
479
+ 15
480
+ 49
481
+ 8
482
+ 1
483
+ 11
484
+ I
485
+ 9
486
+ I
487
+ 1
488
+ I
489
+ 1
490
+ I
491
+ 1
492
+ n
493
+ p
494
+ 9
495
+ x
496
+ 23
497
+ authorized_applications
498
+ x
499
+ 5
500
+ joins
501
+ x
502
+ 4
503
+ Hash
504
+ x
505
+ 16
506
+ new_from_literal
507
+ x
508
+ 19
509
+ oauth_access_tokens
510
+ x
511
+ 17
512
+ resource_owner_id
513
+ x
514
+ 2
515
+ id
516
+ x
517
+ 3
518
+ []=
519
+ x
520
+ 5
521
+ where
522
+ p
523
+ 5
524
+ I
525
+ -1
526
+ I
527
+ f
528
+ I
529
+ 0
530
+ I
531
+ 10
532
+ I
533
+ 2c
534
+ x
535
+ 65
536
+ /Users/felipeelias/Applicake/doorkeeper/app/models/application.rb
537
+ p
538
+ 1
539
+ x
540
+ 14
541
+ resource_owner
542
+ x
543
+ 13
544
+ attach_method
545
+ x
312
546
  7
313
547
  private
314
548
  M
@@ -362,15 +596,15 @@ p
362
596
  I
363
597
  -1
364
598
  I
365
- d
599
+ 14
366
600
  I
367
601
  0
368
602
  I
369
- 14
603
+ 1b
370
604
  I
371
605
  1
372
606
  I
373
- e
607
+ 15
374
608
  I
375
609
  11
376
610
  x
@@ -428,15 +662,15 @@ p
428
662
  I
429
663
  -1
430
664
  I
431
- 11
665
+ 18
432
666
  I
433
667
  0
434
668
  I
435
- 14
669
+ 1b
436
670
  I
437
671
  1
438
672
  I
439
- 12
673
+ 19
440
674
  I
441
675
  d
442
676
  x
@@ -445,7 +679,7 @@ x
445
679
  p
446
680
  0
447
681
  p
448
- 19
682
+ 25
449
683
  I
450
684
  2
451
685
  I
@@ -453,37 +687,49 @@ I
453
687
  I
454
688
  f
455
689
  I
456
- 3
690
+ 4
457
691
  I
458
- 18
692
+ 17
459
693
  I
460
- 5
694
+ 6
461
695
  I
462
- 20
696
+ 1f
463
697
  I
464
698
  7
465
699
  I
466
- 3b
700
+ 4e
467
701
  I
468
702
  8
469
703
  I
470
- 5a
704
+ 6f
471
705
  I
472
706
  a
473
707
  I
474
- 74
708
+ 8a
475
709
  I
476
- c
710
+ b
477
711
  I
478
- 78
712
+ a9
479
713
  I
480
714
  d
481
715
  I
482
- 86
716
+ c3
483
717
  I
484
- 11
718
+ f
719
+ I
720
+ ce
721
+ I
722
+ 13
723
+ I
724
+ d2
725
+ I
726
+ 14
727
+ I
728
+ e0
729
+ I
730
+ 18
485
731
  I
486
- 94
732
+ ee
487
733
  x
488
734
  65
489
735
  /Users/felipeelias/Applicake/doorkeeper/app/models/application.rb