All Projects → hectane → go-acl

hectane / go-acl

Licence: MIT license
Go library for manipulating ACLs on Windows

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to go-acl

Accesscontrol
Role and Attribute based Access Control for Node.js
Stars: ✭ 1,723 (+1676.29%)
Mutual labels:  permissions, acl
Lock Laravel
This package is a Laravel 5 driver for Lock
Stars: ✭ 161 (+65.98%)
Mutual labels:  permissions, acl
Laratrust
Handle roles and permissions in your Laravel application
Stars: ✭ 1,799 (+1754.64%)
Mutual labels:  permissions, acl
Vakt
Attribute-based access control (ABAC) SDK for Python
Stars: ✭ 92 (-5.15%)
Mutual labels:  permissions, acl
spicedb
Open Source, Google Zanzibar-inspired fine-grained permissions database
Stars: ✭ 3,358 (+3361.86%)
Mutual labels:  permissions, acl
Simpleacl
Simple ACL for PHP
Stars: ✭ 105 (+8.25%)
Mutual labels:  permissions, acl
Think Authz
An authorization library that supports access control models like ACL, RBAC, ABAC in ThinkPHP 6.0 .
Stars: ✭ 155 (+59.79%)
Mutual labels:  permissions, acl
Ngx Permissions
Permission and roles based access control for your angular(angular 2,4,5,6,7,9+) applications(AOT, lazy modules compatible
Stars: ✭ 749 (+672.16%)
Mutual labels:  permissions, acl
Rbac
Hierarchical Role-Based Access Control for Node.js
Stars: ✭ 254 (+161.86%)
Mutual labels:  permissions, acl
Bouncer
Eloquent roles and abilities.
Stars: ✭ 2,763 (+2748.45%)
Mutual labels:  permissions, acl
laravel-zend-acl
Adds ACL to Laravel via Zend\Permissions\Acl component.
Stars: ✭ 41 (-57.73%)
Mutual labels:  permissions, acl
nova-permissions
Add Permissions based authorization for your Nova installation via User-based Roles and Permissions. Roles are defined in the database whereas Permissions are defined in the code base.
Stars: ✭ 115 (+18.56%)
Mutual labels:  permissions, acl
Brandenburg
Laravel Authentication Package
Stars: ✭ 79 (-18.56%)
Mutual labels:  permissions, acl
Unix Permissions
Swiss Army knife for Unix permissions
Stars: ✭ 106 (+9.28%)
Mutual labels:  permissions, acl
Lock
A flexible, driver based Acl package for PHP 5.4+
Stars: ✭ 913 (+841.24%)
Mutual labels:  permissions, acl
Laravel Authz
An authorization library that supports access control models like ACL, RBAC, ABAC in Laravel.
Stars: ✭ 136 (+40.21%)
Mutual labels:  permissions, acl
laravel-acl
Laravel ACL is a simple role, permission ACL for Laravel Framework.
Stars: ✭ 78 (-19.59%)
Mutual labels:  permissions, acl
Casl
CASL is an isomorphic authorization JavaScript library which restricts what resources a given user is allowed to access
Stars: ✭ 3,610 (+3621.65%)
Mutual labels:  permissions, acl
Adonis Acl
demo app: https://github.com/enniel/adonis-acl-blog-demo
Stars: ✭ 195 (+101.03%)
Mutual labels:  permissions, acl
rbac
Simple RBAC/ACL for Laravel 8 caching and permission groups.
Stars: ✭ 43 (-55.67%)
Mutual labels:  permissions, acl

go-acl

Build status GoDoc MIT License

Manipulating ACLs (Access Control Lists) on Windows is difficult. go-acl wraps the Windows API functions that control access to objects, simplifying the process.

Using the Package

To use the package add the following imports:

import (
    "github.com/hectane/go-acl"
    "golang.org/x/sys/windows"
)

Examples

Probably the most commonly used function in this package is Chmod:

if err := acl.Chmod("C:\\path\\to\\file.txt", 0755); err != nil {
    panic(err)
}

To grant read access to user "Alice" and deny write access to user "Bob":

if err := acl.Apply(
    "C:\\path\\to\\file.txt",
    false,
    false,
    acl.GrantName(windows.GENERIC_READ, "Alice"),
    acl.DenyName(windows.GENERIC_WRITE, "Bob"),
); err != nil {
    panic(err)
}

Using the API Directly

go-acl's api package exposes the individual Windows API functions that are used to manipulate ACLs. For example, to retrieve the current owner of a file:

import (
    "github.com/hectane/go-acl/api"
    "golang.org/x/sys/windows"
)

var (
    owner   *windows.SID
    secDesc windows.Handle
)
err := api.GetNamedSecurityInfo(
    "C:\\path\\to\\file.txt",
    api.SE_FILE_OBJECT,
    api.OWNER_SECURITY_INFORMATION,
    &owner,
    nil,
    nil,
    nil,
    &secDesc,
)
if err != nil {
    panic(err)
}
defer windows.LocalFree(secDesc)

owner will then point to the SID for the owner of the file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].