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

Can I write all policies in one json file? #101

Open
puraminy opened this issue Dec 12, 2023 · 1 comment
Open

Can I write all policies in one json file? #101

puraminy opened this issue Dec 12, 2023 · 1 comment

Comments

@puraminy
Copy link

Can I write all policies for different resources in one json file? if yes how to use it?

@vpsinghg
Copy link

Yes, you can write them in one json file and read that file inside the method get_policy_statements.
Here is the Pseudocode for that.

import json

class YourCustomAccessPolicy(AccessPolicy):
    id = 'custom-policy'

    def get_policy_statements(self, request, view) -> List[dict]:
        statements  = open('data.json')
        return json.loads(statements)

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