Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method create_operation_set does not exists #135

Open
geonnave opened this issue Feb 26, 2018 · 4 comments
Open

Method create_operation_set does not exists #135

geonnave opened this issue Feb 26, 2018 · 4 comments

Comments

@geonnave
Copy link
Contributor

Hi,

I installed this gem and tried to follow the README instructions in the the irb shell. It went fine* for some instructions, but the create_operation_set method did not work. Maybe the API has changed and not reflected in the README?

  • the code policy_machine = PolicyMachine.new('my_policy_machine', ::PolicyMachineStorageAdapter::InMemory) did not work with the code I downloaded from develop branch. I changed it to just policy_machine = PolicyMachine.new and it worked.

P.S.: I am researching access control for IoT and the Policy Machine seems to be a good alternative, so I was interested in testing your project to have an idea of the available open source solutions out there.

@fpcyan
Copy link

fpcyan commented Feb 28, 2018

Hey! That's exciting.

When you say it did not work, can you describe precisely how it did not work? Error messages, ruby version, etc. are all very helpful in identifying the root cause.

@geonnave
Copy link
Contributor Author

geonnave commented Mar 1, 2018

Sure, my bad. I can't reproduce it right now, but the error indicated that the create_operation_set method was missing. I did grep through the codebase and indeed coundn't find the method, so I thought the README could be outdated. I will try to reproduce again when possible and post full logs.

@geonnave
Copy link
Contributor Author

Hi, just to let you know. The version I've got when installing via Ruby gems is 0.0.2, as in:

$ sudo gem install policy_machine
Fetching: concurrent-ruby-1.0.5.gem (100%)                                                                                                                                                                         
Successfully installed concurrent-ruby-1.0.5                                                                                                                                                                       
Fetching: i18n-1.1.0.gem (100%)                                                                                                                                                                                    
Successfully installed i18n-1.1.0                                                                                                                                                                                  
Fetching: thread_safe-0.3.6.gem (100%)                                                                                                                                                                             
Successfully installed thread_safe-0.3.6                                                                                                                                                                           
Fetching: tzinfo-1.2.5.gem (100%)                                                                                                                                                                                  
Successfully installed tzinfo-1.2.5                                                                                                                                                                                
Fetching: activesupport-5.2.1.gem (100%)                                                                                                                                                                           
Successfully installed activesupport-5.2.1                                                                                                                                                                         
Fetching: policy_machine-0.0.2.gem (100%)                                                                                                                                                                          
Successfully installed policy_machine-0.0.2                                                                                                                                                                        
Parsing documentation for concurrent-ruby-1.0.5                                                                                                                                                                    
Installing ri documentation for concurrent-ruby-1.0.5                                                                                                                                                              
Parsing documentation for i18n-1.1.0                                                                                                                                                                               
Installing ri documentation for i18n-1.1.0                                                                                                                                                                         
Parsing documentation for thread_safe-0.3.6                                                                                                                                                                        
Installing ri documentation for thread_safe-0.3.6                                                                                                                                                                  
Parsing documentation for tzinfo-1.2.5                                                                                                                                                                             
Installing ri documentation for tzinfo-1.2.5                                                                                                                                                                      
Parsing documentation for activesupport-5.2.1                                                                                                                                                                   
Installing ri documentation for activesupport-5.2.1                                                                                                                                                               
Parsing documentation for policy_machine-0.0.2                                
Installing ri documentation for policy_machine-0.0.2              
Done installing documentation for concurrent-ruby, i18n, thread_safe, tzinfo, activesupport, policy_machine after 8 seconds
6 gems installed

Navigating through the codebase, I assume that version is outdated. Which must be the reason for the README instructions not working anymore.

I tried installing a newer version, but that didn't work.

$ sudo gem install policy_machine -v 1.8.1
ERROR:  Could not find a valid gem 'policy_machine' (= 1.8.1) in any repository
ERROR:  Possible alternatives: policy_machine

I'm using ruby v2.5.

@geonnave
Copy link
Contributor Author

So I've cloned the code and tinkered with it a bit, and I've found the following inconsistencies in the README:

  • there's no add_association method
irb(main):197:0> policy_machine.add_association(division, Set.new([r,prohibit_w]),project1)
Traceback (most recent call last):
        4: from /usr/bin/irb:11:in `<main>'
        3: from (irb):197
        2: from /var/lib/gems/2.5.0/gems/policy_machine-1.8.1/lib/policy_machine.rb:79:in `add_association'
        1: from /var/lib/gems/2.5.0/gems/policy_machine-1.8.1/lib/policy_machine.rb:354:in `assert_policy_element_in_machine'
ArgumentError (arg must each be a kind of PolicyElement; got Set instead)
  • there's no link_descendants method
irb(main):198:0> u4_descendant_links = u4.link_descendants
Traceback (most recent call last):
        3: from /usr/bin/irb:11:in `<main>'
        2: from (irb):198
        1: from /var/lib/gems/2.5.0/gems/policy_machine-1.8.1/lib/policy_machine/policy_element.rb:110:in `method_missing'
NoMethodError (undefined method `link_descendants' for #<PM::User u4>)
  • actually, it seems not to have any link_* method anymore (as described in the README):
irb(main):199:0> u4.methods.grep(/desc/)
=> []

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants