• Stars
    star
    2
  • Language
    Go
  • License
    MIT License
  • Created almost 9 years ago
  • Updated almost 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple but powerful Access Control List manager

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

More Repositories

1

json2react

Use JSON to create React Components.
JavaScript
167
star
2

meteor-simple-i18n

Simple I18n support for meteor
JavaScript
20
star
3

uml.js

ABANDONED - JSON to UML (or something like it)
JavaScript
14
star
4

command

Command pattern for Go with thread safe serial and parallel dispatcher
Go
14
star
5

fw

Micro PHP Framework
PHP
11
star
6

parseargs-go

A string argument parser that understands quotes and backslashes
Go
10
star
7

syte-yii

Syte as a Yii Framework module
JavaScript
5
star
8

itunes-cli

Objective-C
5
star
9

parseargs.js

A string argument parser that understands quotes and backslashes
JavaScript
4
star
10

retry-go

Retry a function execution with specific intervals with panic recovery
Go
4
star
11

meteor-namespace

Namespace helper for Meteor
JavaScript
3
star
12

jslib-dot

Dot notation setter and getter
JavaScript
2
star
13

tic-80-carts

JavaScript
2
star
14

pigo8

Go
2
star
15

safe

Safe file storage
Go
2
star
16

yttr

A cli client for yttr.co
Go
2
star
17

meteor-simple-i18n-sample

https://github.com/txgruppi/meteor-simple-i18n
JavaScript
2
star
18

run

A tool for Docker containers that render config files, extend the environment and run commands
Go
2
star
19

bee.js

A bitwise powered event emitter :-)
JavaScript
2
star
20

youtube-cli

Objective-C
1
star
21

rproxy

A proxy that applies AES encryption over requests in order to prevent scrapers from easily accessing our data
Go
1
star
22

errorgroup-go

ErrorGroup is an error type that can hold other errors together.
Go
1
star
23

study-server

Go
1
star
24

fns

A set of Go functions to work with lazy sequences without reflection.
Go
1
star
25

node-gs-dl

Grooveshark Downloader
JavaScript
1
star
26

builtwith-cli

A command line interface for BuiltWith API
Shell
1
star
27

config

Go
1
star