sample code to implement oslo policy

Bug #1602206 reported by Binoy M V
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.policy
Expired
Undecided
Unassigned

Bug Description

Hi,

I am trying to implement the pecan rest framework with policy. How can I do that. I tried with the following but getting error on that. Please help

My policy file (policy.json = which is in the folder "controller")
http://paste.openstack.org/show/532752/

I am trying to call the following from my pecan rootcontroller
rbac.enforce("events:index", pecan.request)

My rbac.py file (oslo code)
http://paste.openstack.org/show/532751/

I am trying to call it using the following
http://paste.openstack.org/show/532753/

Getting following o/p while printing the self from load_rules()
print self.__dict__

{'policy_file': 'policy.json', 'policy_path': None, 'rules': {}, 'file_rules': {}, 'overwrite': True, 'conf': <oslo_config.cfg.ConfigOpts object at 0x7f3ffce81d50>, '_policy_dir_mtimes': {}, 'registered_rules': {}, '_file_cache': {}, 'default_rule': 'default', '_loaded_files': [], 'use_conf': True}

Is this correct behaviour? But I am passing the file as policy.json. Please give me an opening for this.

Tags: python
Binoy M V (binoy-mv)
description: updated
Revision history for this message
ChangBo Guo(gcb) (glongwave) wrote :

what I find now, policy_file want to find 'policy.json', but you provide 'test.json'

Binoy M V (binoy-mv)
description: updated
Revision history for this message
Steve Martinelli (stevemar) wrote :

Did changing the file to policy.json help?

Changed in oslo.policy:
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for oslo.policy because there has been no activity for 60 days.]

Changed in oslo.policy:
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.