sample code to implement oslo policy

Bug #1602206 reported by Binoy M V on 2016-07-12
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.policy
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.

Binoy M V (binoy-mv) on 2016-07-12
description: updated
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) on 2016-07-14
description: updated
Steve Martinelli (stevemar) wrote :

Did changing the file to policy.json help?

Changed in oslo.policy:
status: New → Incomplete
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  Edit
Everyone can see this information.

Other bug subscribers