Documentation ¶
Index ¶
- Constants
- Variables
- func CheckKetoPolicy(entity, action string) func(h http.Handler) http.Handler
- func CheckName(space uint, name, table string) bool
- func CheckNats() bool
- func CheckOwnerFromKavach(uID, oID int) (bool, error)
- func CheckSpaceKetoPermission(action string, oID, uID uint) error
- func ConnectNats()
- func FactCheckPermission(h http.Handler) http.Handler
- func GenerateOrganisation(h http.Handler) http.Handler
- func GetAllOrganisationsMap(q string) (map[uint]model.Organisation, error)
- func GetOrganisation(ctx context.Context) (int, error)
- func GetRequest(url string) error
- func HTMLDescription(jsonData postgres.Jsonb) (string, error)
- func IsAllowed(result KetoAllowed) (int, error)
- func KavachChecker() error
- func KetoChecker() error
- func KetoGetRequest(path string) (*http.Response, error)
- func KratosChecker() error
- func MeiliChecker() error
- func PodcastPermission(h http.Handler) http.Handler
- type KetoAllowed
Constants ¶
const OrganisationIDKey ctxKeyOrganisationID = 0
OrganisationIDKey is the key that holds the unique user ID in a request context.
Variables ¶
var NC *nats.EncodedConn
NC nats connection object
Functions ¶
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 FactCheckPermission ¶
FactCheckPermission checks weather organisation has fact-check permission
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 GetRequest ¶
GetRequest returns error if error in status code
func IsAllowed ¶
func IsAllowed(result KetoAllowed) (int, error)
IsAllowed checks if keto policy allows user to action on resource
func KetoGetRequest ¶
KetoGetRequest does get request to keto with empty body
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