class Acl::Groups

Overview

The Groups is used to handle a set of uniq Group, by name.

Included Modules

Defined in:

lib/acl/groups.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Lockable

load! load!, save! save!, transaction!(read = false, &) transaction!

Constructor Detail

def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) #

[View source]
def self.new(file : String) #
acls = Acl::Groups.new
g1 = Acl::Group.new(name: "user", default: Acl::Perm::Read, permissions: {"/tmp/protected" => Acl::Perm::None})
g2 = Acl::Group.new(name: "admin", default: Acl::Perm::Write)
acls.add g1
acls.add g2

[View source]

Class Method Detail

def self.read(file : String) #

[View source]

Instance Method Detail

def [](group : String) : Acl::Group #

[View source]
def [](group : Acl::Group) : Acl::Group #

[View source]
def []?(group : String) : Acl::Group | Nil #

[View source]
def []?(group : Acl::Group) : Acl::Group | Nil #

[View source]
def add(group : String) #

[View source]
def add(group : Acl::Group) #

[View source]
def add_permissions_to(path : String, groups : Array(String), acl : Acl::Perm) #

[View source]
def clear_permissions_of(path : String, acl : Acl::Perm) #

[View source]
def clear_permissions_of(path : String) #

[View source]
def delete(group : String) #

[View source]
def delete(group : Acl::Group) #

[View source]
def file : String #

[View source]
def file=(file : String) #

[View source]
def group_exists?(group : String) : Bool #

[View source]
def group_exists?(group : Acl::Groum) : Bool #

[View source]
def groups : Hash(String, Acl::Group) #

[View source]
def groups=(groups : Hash(String, Acl::Group)) #

[View source]
def groups_having_any_access_to(path : String, acl_min : Acl::Perm, not_more : Bool = false) : Array(String) #

[View source]
def groups_having_direct_access_to(path : String, acl_min : Acl::Perm, not_more : Bool = false) : Array(String) #

List the groups having at least the permission acl_min on a path


[View source]
def load! #

Read the file and erase the content, skip if the file does not exists


[View source]
def permitted?(entity : Acl::Entity, path : String, access : Acl::Perm) #

Check if an Entity has a group with the required permissions to operate.

acls = Groups.new...user = User.new...acls.permitted?(user, "/my/path", Perm::Read)

[View source]
def save! #

[View source]