pebblebed 0.0.55 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/pebblebed/sinatra.rb +1 -1
- data/lib/pebblebed/version.rb +1 -1
- data/spec/sinatra_spec.rb +5 -5
- metadata +3 -8
data/lib/pebblebed/sinatra.rb
CHANGED
@@ -101,7 +101,7 @@ module Sinatra
|
|
101
101
|
require_identity
|
102
102
|
uid = ::Pebblebed::Uid.new(uid) if uid.is_a?(String)
|
103
103
|
return if current_identity.god and uid.path.split(".")[0] == current_identity.realm
|
104
|
-
res = pebbles.checkpoint.
|
104
|
+
res = pebbles.checkpoint.post("/callbacks/allowed/#{action}/#{uid}")
|
105
105
|
return res['allowed'] if res['allowed'] == true or
|
106
106
|
(res['allowed'] == "default" and options[:default])
|
107
107
|
halt 403, ":#{action} denied for #{uid} : #{res['reason']}"
|
data/lib/pebblebed/version.rb
CHANGED
data/spec/sinatra_spec.rb
CHANGED
@@ -193,7 +193,7 @@ describe Sinatra::Pebblebed do
|
|
193
193
|
specify "is disallowed" do
|
194
194
|
user!
|
195
195
|
checkpoint.should_receive(:get).with("/identities/me").and_return(DeepStruct.wrap(:identity => {:realm => 'testrealm', :id => 1, :god => false}))
|
196
|
-
checkpoint.should_receive(:
|
196
|
+
checkpoint.should_receive(:post).with("/callbacks/allowed/create/post.foo:testrealm").and_return(DeepStruct.wrap(:allowed => false, :reason => "You are not worthy!"))
|
197
197
|
Pebblebed::Connector.any_instance.stub(:checkpoint => checkpoint)
|
198
198
|
post '/create/post.foo:testrealm'
|
199
199
|
last_response.status.should == 403
|
@@ -204,7 +204,7 @@ describe Sinatra::Pebblebed do
|
|
204
204
|
specify "is allowed" do
|
205
205
|
user!
|
206
206
|
checkpoint.should_receive(:get).with("/identities/me").and_return(DeepStruct.wrap(:identity => {:realm => 'testrealm', :id => 1, :god => false}))
|
207
|
-
checkpoint.should_receive(:
|
207
|
+
checkpoint.should_receive(:post).with("/callbacks/allowed/create/post.foo:testrealm").and_return(DeepStruct.wrap(:allowed => true))
|
208
208
|
Pebblebed::Connector.any_instance.stub(:checkpoint => checkpoint)
|
209
209
|
post '/create/post.foo:testrealm'
|
210
210
|
last_response.body.should == "You are creative"
|
@@ -213,7 +213,7 @@ describe Sinatra::Pebblebed do
|
|
213
213
|
specify "is disallowed" do
|
214
214
|
user!
|
215
215
|
checkpoint.should_receive(:get).with("/identities/me").and_return(DeepStruct.wrap(:identity => {:realm => 'testrealm', :id => 1, :god => false}))
|
216
|
-
checkpoint.should_receive(:
|
216
|
+
checkpoint.should_receive(:post).with("/callbacks/allowed/create/post.foo:testrealm").and_return(DeepStruct.wrap(:allowed => "default"))
|
217
217
|
Pebblebed::Connector.any_instance.stub(:checkpoint => checkpoint)
|
218
218
|
post '/create2/post.foo:testrealm'
|
219
219
|
last_response.status.should == 403
|
@@ -223,7 +223,7 @@ describe Sinatra::Pebblebed do
|
|
223
223
|
specify "is disallowed" do
|
224
224
|
user!
|
225
225
|
checkpoint.should_receive(:get).with("/identities/me").and_return(DeepStruct.wrap(:identity => {:realm => 'testrealm', :id => 1, :god => false}))
|
226
|
-
checkpoint.should_receive(:
|
226
|
+
checkpoint.should_receive(:post).with("/callbacks/allowed/create/post.foo:testrealm").and_return(DeepStruct.wrap(:allowed => "default"))
|
227
227
|
Pebblebed::Connector.any_instance.stub(:checkpoint => checkpoint)
|
228
228
|
post '/create/post.foo:testrealm'
|
229
229
|
last_response.status.should == 403
|
@@ -233,7 +233,7 @@ describe Sinatra::Pebblebed do
|
|
233
233
|
specify "is allowed" do
|
234
234
|
user!
|
235
235
|
checkpoint.should_receive(:get).with("/identities/me").and_return(DeepStruct.wrap(:identity => {:realm => 'testrealm', :id => 1, :god => false}))
|
236
|
-
checkpoint.should_receive(:
|
236
|
+
checkpoint.should_receive(:post).with("/callbacks/allowed/create/post.foo:testrealm").and_return(DeepStruct.wrap(:allowed => "default"))
|
237
237
|
Pebblebed::Connector.any_instance.stub(:checkpoint => checkpoint)
|
238
238
|
post '/create3/post.foo:testrealm'
|
239
239
|
last_response.body.should == "You are creative"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pebblebed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-06-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -329,18 +329,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
329
329
|
- - ! '>='
|
330
330
|
- !ruby/object:Gem::Version
|
331
331
|
version: '0'
|
332
|
-
segments:
|
333
|
-
- 0
|
334
|
-
hash: -2508269950246086349
|
335
332
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
336
333
|
none: false
|
337
334
|
requirements:
|
338
335
|
- - ! '>='
|
339
336
|
- !ruby/object:Gem::Version
|
340
337
|
version: '0'
|
341
|
-
segments:
|
342
|
-
- 0
|
343
|
-
hash: -2508269950246086349
|
344
338
|
requirements: []
|
345
339
|
rubyforge_project: pebblebed
|
346
340
|
rubygems_version: 1.8.25
|
@@ -363,3 +357,4 @@ test_files:
|
|
363
357
|
- spec/sinatra_spec.rb
|
364
358
|
- spec/spec_helper.rb
|
365
359
|
- spec/uid_spec.rb
|
360
|
+
has_rdoc:
|