Popularity
0.6
Stable
Activity
0.0
Stable
2
2
0

Programming language: Go
License: MIT License
Tags: Permissions     Security     ACL    

ACL alternatives and similar packages

Based on the "Security" category.
Alternatively, view ACL alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of ACL or a related project?

Add another 'Security' Package

README

GoDoc Codeship Codecov Go Report Card

ACL - Access Control List

ACL is a simple but powerful Access Control List manager

Installation

go get -u github.com/txgruppi/acl-go

Example

You should not ignore the errors returned by the methods

package main

import (
  "fmt"

  "github.com/txgruppi/acl-go"
  "github.com/txgruppi/acl-go/driver/memory"
)

func main() {
  driver := memory.NewDriver()

  // Driver can be directly used as ACL managers
  var manager acl.ACL = driver

  // Set the default policy as Deny
  acl.SetDefaultPolicy(acl.Deny)

  // Get some users
  userCEO, _ := acl.GetActor("userCEO_UUID")
  userDeveloper, _ := acl.GetActor("userDeveloper_UUID")

  // Get some actions
  accessBackAccount, _ := acl.GetAction("accessBackAccount")
  accessProductionServer, _ := acl.GetAction("accessProductionServer")

  // Set rules
  acl.Set(userCEO, accessBackAccount, acl.Allow)
  acl.Set(userDeveloper, accessProductionServer, acl.Allow)

  // Check using the ACL manager
  allowed, _ := acl.IsAllowed(userCEO, accessBackAccount)
  fmt.Println(allowed) // true
  allowed, _ = acl.IsAllowed(userDeveloper, accessBackAccount)
  fmt.Println(allowed) // false

  // Check using the Actor or Action struct
  allowed, _ := userCEO.IsAllowed(accessProductionServer)
  fmt.Println(allowed) // false
  allowed, _ = accessProductionServer.Allows(userDeveloper)
  fmt.Println(allowed) // true
}

Tests

go get -u -t github.com/txgruppi/acl-go
cd $GOPATH/src/github.com/txgruppi/acl-go
go test ./...

License

MIT


*Note that all licence references and agreements mentioned in the ACL README section above are relevant to that project's source code only.