itkacl-go is a Go library for interfacing with the ITKACL access control system.
Before using this package, make sure the ITKACL library is installed on your system.
Refer to the ITKACL documentation for installation instructions.
Then install this package:
go get github.com/itkinside/itkacl-goAt the start of your application, initialize and free the ITKACL context:
import (
"github.com/itkinside/itkacl-go"
)
func main() {
itkacl.ItkaclInit()
defer itkacl.ItkaclFree()
// the rest of your program
}This creates a global, reusable context for ITKACL queries.
To perform an ITKACL access check:
access, err := itkacl.ItkaclCheck(g.Realm, remoteUser)
if err != nil {
log.Printf("Could not perform ITKACL check on realm %s: %v", g.Realm, err)
return false
}
if access == nil {
return false
}
return *access