mistiq 0.0.85 → 0.0.86

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjQ0N2YzNTkwYjhhMWFkNjk0OTEzM2Y2MjEyYjQ1OGE5NTEyOTAyOQ==
4
+ OWQxMTc1YjE2OTNjODliYjI4NWFkODIzNDExZDkwMmNiNWQ5NGUyNg==
5
5
  data.tar.gz: !binary |-
6
- OGJjMjJjZjlmNTk5NjJjNDQyMTM4NmFhNzBiNGRkMzU0Mzg5MTU3NA==
6
+ ZjY4ZDNiMWY4MzY4NTllZjFjM2ZlZWNlNWZkMjcxNjgyNGY4NDkwYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZThkMWZlYmQ3MTU0NDNhMDU1N2VlM2NjNmY4MjM0MjkxNTQ5N2M3NDRkOGNk
10
- MzIwYmY1MDNjNWMxZGQwNmJjNzE0OWRkZGFmMGRjZWM4OTlkNjNiMTMzNWZj
11
- YTIwZTJhZGQxNTQ1YzY4NDkxYmJiMDFkYzU3NmQxYmQ2MmI4M2Y=
9
+ YmVlYzQ0NGE2MzAzNTdmMzE4MzcwODAzYzEzNmFkNDFhZWEyZDM2NzA0Y2Qx
10
+ Y2JlNDNhN2E3OGJhMjI4NDI5NDhjZTZhNWQ1YTc2MTczZjA1MDE2N2U4ZTNi
11
+ YzYzY2M0NTQwY2U3OWI3NzMzMjgwYzgzNmQ3ZDUyNDE2MzYyNTY=
12
12
  data.tar.gz: !binary |-
13
- OGMxMzI1YmU3MzJiNjY2MzNjNjg5MDFkZGQ2OWJmZTA2ZDNiM2E0MGQyYTU0
14
- ZWU0OTNkYmM1OWQ5YTdkM2MwNjRkZmRiMDMxZDY3NjMwMTA0MzU4MmY5MTZh
15
- MTk0OThhOTliYzBhYzFiMTliNjQ2MGYyMDQzMjY5MjVlMDE5MTg=
13
+ MmMyYzVlYmQ0ZGZhOWJmMGI3ODAwOTZiMTRmYjA5YjM2MGIyZDUwMjgwNzNi
14
+ MzUzMjIyNzkyZjA3NzcyNGExNzQ4MTVmMDM1MWQzNzgwNWM1MDA5ZTgzZjBm
15
+ NmE1YmQxZDQ1N2Q3NzhlMDQ3ZDU5NjVkZjkyMDQzMDg0ODc5YzY=
@@ -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
- disable_action(pair_array[0],pair_array[1])
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 specified action in the controller
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
@@ -20,7 +20,7 @@ module Mistiq
20
20
 
21
21
  regex.each {
22
22
  |r|
23
- temp = body.gsub(/#{r}/,"Redacted")
23
+ temp = body.gsub(/#{r}/,"")
24
24
  if temp != nil
25
25
  body = temp
26
26
  end
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.85
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-05 00:00:00.000000000 Z
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: []