mistiq 0.0.85 → 0.0.86
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.
- checksums.yaml +8 -8
- data/lib/mistiq/base.rb +11 -7
- data/lib/mistiq/defaults.rb +24 -0
- data/lib/mistiq/middleware.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OWQxMTc1YjE2OTNjODliYjI4NWFkODIzNDExZDkwMmNiNWQ5NGUyNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjY4ZDNiMWY4MzY4NTllZjFjM2ZlZWNlNWZkMjcxNjgyNGY4NDkwYw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YmVlYzQ0NGE2MzAzNTdmMzE4MzcwODAzYzEzNmFkNDFhZWEyZDM2NzA0Y2Qx
|
10
|
+
Y2JlNDNhN2E3OGJhMjI4NDI5NDhjZTZhNWQ1YTc2MTczZjA1MDE2N2U4ZTNi
|
11
|
+
YzYzY2M0NTQwY2U3OWI3NzMzMjgwYzgzNmQ3ZDUyNDE2MzYyNTY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmMyYzVlYmQ0ZGZhOWJmMGI3ODAwOTZiMTRmYjA5YjM2MGIyZDUwMjgwNzNi
|
14
|
+
MzUzMjIyNzkyZjA3NzcyNGExNzQ4MTVmMDM1MWQzNzgwNWM1MDA5ZTgzZjBm
|
15
|
+
NmE1YmQxZDQ1N2Q3NzhlMDQ3ZDU5NjVkZjkyMDQzMDg0ODc5YzY=
|
data/lib/mistiq/base.rb
CHANGED
@@ -43,7 +43,7 @@ module Mistiq
|
|
43
43
|
if(current_controller == pair_array[0] && current_action == pair_array[1])
|
44
44
|
disable(pair_array[0],pair_array[1],pair[2])
|
45
45
|
else
|
46
|
-
|
46
|
+
remove_links(pair_array[0],pair_array[1])
|
47
47
|
end
|
48
48
|
end
|
49
49
|
}
|
@@ -63,8 +63,9 @@ module Mistiq
|
|
63
63
|
|
64
64
|
#disable both the view and the action (links for the action in other views)
|
65
65
|
def disable(controller,action,alternate_view)
|
66
|
-
disable_view(controller,action,alternate_view)
|
66
|
+
#disable_view(controller,action,alternate_view)
|
67
67
|
disable_action(controller,action)
|
68
|
+
remove_links(controller,action)
|
68
69
|
end
|
69
70
|
|
70
71
|
#disable the view when url is requested
|
@@ -72,14 +73,17 @@ module Mistiq
|
|
72
73
|
render :text => action, :layout => alternate_view
|
73
74
|
puts "Disabled view for action #{action}, controller #{controller}"
|
74
75
|
end
|
75
|
-
|
76
|
-
#disable the
|
77
|
-
#by removing the links from the rendered HTML and by
|
78
|
-
#disabling the action in the model
|
76
|
+
|
77
|
+
#disable access to the action/controller by rerouting
|
79
78
|
def disable_action(controller,action)
|
79
|
+
redirect_to :root
|
80
|
+
end
|
81
|
+
|
82
|
+
#remove the links from the rendered HTML for
|
83
|
+
#the specific action/controller
|
84
|
+
def remove_links(controller,action)
|
80
85
|
to_disable = "#{controller}##{action}"
|
81
86
|
ENV['REGEX'] += Railtie.get_regex_hash[to_disable]+"@@@"
|
82
87
|
puts "Removed links for action #{action}, controller #{controller}"
|
83
|
-
#TODO: should also disable ACTUAL action in the model
|
84
88
|
end
|
85
89
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Mistiq
|
2
|
+
def self.included(base)
|
3
|
+
#base.send(:before_filter, :set_guard_on)
|
4
|
+
end
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
super
|
8
|
+
@mode_class = self.class
|
9
|
+
#create hash of keys and condition/consequence pairs
|
10
|
+
end
|
11
|
+
|
12
|
+
#add a new rule to look out for
|
13
|
+
#takes in an optional parameter for the view to
|
14
|
+
#be rendered in place of the current one
|
15
|
+
def disable_edit_ops()
|
16
|
+
Railtie.get_regex_hash.each {
|
17
|
+
|r|
|
18
|
+
if(r.match(/.*#edit/))
|
19
|
+
ENV['REGEX'] += Railtie.get_regex_hash[to_disable]+"@@@"
|
20
|
+
}
|
21
|
+
#ENV['REGEX'] += Railtie.get_regex_hash[to_disable]+"@@@"
|
22
|
+
puts "All edit operations have been disabled."
|
23
|
+
end
|
24
|
+
end
|
data/lib/mistiq/middleware.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.86
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrei Papancea
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Dynamically restrict access to your Rails application
|
14
14
|
email: alp2200@columbia.edu
|
@@ -21,6 +21,7 @@ files:
|
|
21
21
|
- lib/mistiq/base.rb
|
22
22
|
- lib/mistiq/middleware.rb
|
23
23
|
- lib/mistiq/init.rb
|
24
|
+
- lib/mistiq/defaults.rb
|
24
25
|
- bin/mistiq
|
25
26
|
homepage:
|
26
27
|
licenses: []
|