Documentation ¶
Index ¶
- Constants
- Variables
- func CheckCategoryName(space uint, name string, IsForTemplate bool) bool
- func CheckKetoPolicy(entity, action string) func(h http.Handler) http.Handler
- func CheckName(space uint, name, table string) bool
- func CheckOwnerFromKavach(uID, oID int) (bool, error)
- func CheckSpaceKetoPermission(action string, oID, uID uint) error
- func GenerateOrganisation(h http.Handler) http.Handler
- func GetAllOrganisationsMap(q string) (map[uint]model.Organisation, error)
- func GetOrganisation(ctx context.Context) (int, error)
- func HTMLDescription(jsonData postgres.Jsonb) (string, error)
- func IsAllowed(result KetoAllowed) (int, error)
- func KavachChecker() error
- func KetoChecker() error
- func NilJsonb() postgres.Jsonb
- func Request(method, path string, body interface{}) (*http.Response, error)
- func RequestOrganisation(r *http.Request) ([]model.Organisation, error)
- func SetupTemplates()
- func Unmarshal(data postgres.Jsonb) map[string]interface{}
- type KetoAllowed
Constants ¶
const OrganisationIDKey ctxKeyOrganisationID = 0
OrganisationIDKey is the key that holds the unique user ID in a request context.
Variables ¶
var Template *template.Template
Template template object
Functions ¶
func CheckCategoryName ¶
CheckCategoryName checks if the category table contains any entry with same name
func CheckKetoPolicy ¶
CheckKetoPolicy returns middleware that checks the permissions of user from keto server
func CheckOwnerFromKavach ¶
CheckOwnerFromKavach checks if user is owner of organisation
func CheckSpaceKetoPermission ¶
CheckSpaceKetoPermission checks keto policy for operations on space
func GenerateOrganisation ¶
GenerateOrganisation check X-User in header
func GetAllOrganisationsMap ¶
func GetAllOrganisationsMap(q string) (map[uint]model.Organisation, error)
GetAllOrganisationsMap return slice of all organisations
func GetOrganisation ¶
GetOrganisation return organisation ID
func IsAllowed ¶
func IsAllowed(result KetoAllowed) (int, error)
IsAllowed checks if keto policy allows user to action on resource returns (status code, error)
func RequestOrganisation ¶
func RequestOrganisation(r *http.Request) ([]model.Organisation, error)
RequestOrganisation - request kavach to get all organisations of user
Types ¶
type KetoAllowed ¶
type KetoAllowed struct { Subject string `json:"subject"` Action string `json:"action"` Resource string `json:"resource"` }
KetoAllowed is request object to check permissions of user