mistiq 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/bin/rails/init.rb +51 -0
- data/lib/mistiq.rb +1 -2
- data/lib/mistiq/base.rb +2 -1
- metadata +3 -16
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDI1MjA0MWNhZTAyZTI2M2JlNmZhNTdjODQzZDQ2OGIwNmE0ZDFjYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NWJkYjNlOTUwY2Y5YzA3OTA4NDk3ZGI1YjEyNTdkYzBlNTJlNTRmZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NWM4ZjFmYTBhZjFjNGJlMTVlMzAxNjljZTkyYjhhOGJjYTEyMGMwNmEwZmM1
|
10
|
+
MGNmODIzZTYwZWYyZWU5ZGEwMzkwMjEwZTQ1ZjhlMWIyMmNiYzA4MGUxMDMy
|
11
|
+
ZDMyMmJjZjlmNzhkNmQ1OTQ5Y2YyNzhmMGNlODliM2ZhYmYwOGQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTBjODRlYmNiZThmMDBhMzJkNzA0NWNhNmNkMmY3ZTBlNTEyN2E5YTA0MTAx
|
14
|
+
NmUzYzM0MDUzN2MzZWUxMGUyNmI1NGYyZmIwNzY0NjAwMDYxMmFkNDIxY2E3
|
15
|
+
ODhjODFiMDQ3NjUxYzI0YjA3OTZmYjIwMmVhOTc3ZTkwZWZkZmQ=
|
data/bin/rails/init.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
Rails.application.config.after_initialize do
|
2
|
+
LINK_REGEX_HASH = Hash.new
|
3
|
+
|
4
|
+
#pre-load routes
|
5
|
+
Rails.application.reload_routes!
|
6
|
+
|
7
|
+
#get routes
|
8
|
+
routes = Rails.application.routes.routes
|
9
|
+
|
10
|
+
routes.each {
|
11
|
+
|r|
|
12
|
+
controller = r.defaults[:controller]
|
13
|
+
action = r.defaults[:action]
|
14
|
+
|
15
|
+
route = r.path.spec.to_s
|
16
|
+
|
17
|
+
#removes (.:format)
|
18
|
+
if route.match("(.:format)")
|
19
|
+
pattern = route.sub("(.:format)","")
|
20
|
+
else
|
21
|
+
pattern = route
|
22
|
+
end
|
23
|
+
|
24
|
+
#if there are any parameters in
|
25
|
+
#the route use regex to ignore them
|
26
|
+
if pattern.match(/(:.*\/)/)
|
27
|
+
pattern.gsub!(/(:.*\/)/,".*/")
|
28
|
+
end
|
29
|
+
|
30
|
+
#if there is a parameter at the end
|
31
|
+
if pattern.match(/(:.*)/)
|
32
|
+
pattern.gsub!(/(:.*)/,"[^\/\"]*")
|
33
|
+
end
|
34
|
+
|
35
|
+
if action == "destroy"
|
36
|
+
destroy_regex = "data-method=(\"|')delete(\"|')";
|
37
|
+
pattern = "<a.*#{destroy_regex}.*href=(\"|')#{pattern}(\"|').*>.*<\/a>"
|
38
|
+
#also check if destroy_regex occurs after the href attribute
|
39
|
+
pattern = pattern+"@@@<a.*href=(\"|')#{pattern}(\"|').*#{destroy_regex}.*>.*<\/a>"
|
40
|
+
else
|
41
|
+
pattern = "<a.*href=(\"|')#{pattern}(\"|').*>.*<\/a>"
|
42
|
+
end
|
43
|
+
|
44
|
+
#espace / characters
|
45
|
+
pattern.gsub!(/\//,"\\/")
|
46
|
+
|
47
|
+
LINK_REGEX_HASH["#{controller}##{action}"] = pattern
|
48
|
+
}
|
49
|
+
|
50
|
+
puts "Link REGEX hash has been computed"
|
51
|
+
end
|
data/lib/mistiq.rb
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
require 'mistiq/base'
|
2
|
-
require 'mistiq/security'
|
1
|
+
require 'mistiq/base'
|
data/lib/mistiq/base.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mistiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrei Papancea
|
@@ -9,21 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2013-10-03 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: cancan
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ! '>='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ! '>='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
12
|
+
dependencies: []
|
27
13
|
description: Dynamically restrict access to your Rails application
|
28
14
|
email: alp2200@columbia.edu
|
29
15
|
executables: []
|
@@ -36,6 +22,7 @@ files:
|
|
36
22
|
- lib/mistiq/redactor.rb
|
37
23
|
- lib/mistiq/security.rb
|
38
24
|
- bin/mistiq
|
25
|
+
- bin/rails/init.rb
|
39
26
|
- test/test_mistiq.rb
|
40
27
|
homepage:
|
41
28
|
licenses: []
|