Skip to content

epa-datos/policies

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Role Policies

Summary

EPA digital policies package

Motivation

  • To implement roles with casbin we need to specify which policies we want to implement. This package is intended to hold every policy, so changes in policies would only require changes in this package.

Package structure

  • Policies
    • policy.go
    • Single policy package -> Each policy will have its own folder
      • single_policy.conf -> Each policy requires a .conf file
      • single_policy.csv -> Each policy requires a .csv file

API

To start using a policy from the package you just have to import the package

 "github.com/epa-datos/policies"

The package has the following constants:

  • TestPolicy: Implements a policy for testing purposes
  • CoopPolicy: Implements a policy for cooop roles

Each constant is of type policy, which has two methods:

GetPolicyConfPath

Returns the file path for the .conf file of the policy

  confFilePath := policy.GetPolicyConfPath() 

GetPolicyCsvPath

Returns the file path for the .csv file of the policy

  confFilePath := policy.GetPolicyCsvPath()