Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonathanstowe/object-permission
Experimental method (and public attribute accessor,) level authorisation for Raku objects
https://github.com/jonathanstowe/object-permission
authorization devel object raku
Last synced: 25 days ago
JSON representation
Experimental method (and public attribute accessor,) level authorisation for Raku objects
- Host: GitHub
- URL: https://github.com/jonathanstowe/object-permission
- Owner: jonathanstowe
- License: artistic-2.0
- Created: 2015-10-25T17:25:48.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2022-08-07T08:43:59.000Z (over 2 years ago)
- Last Synced: 2023-04-22T17:06:59.820Z (over 1 year ago)
- Topics: authorization, devel, object, raku
- Language: Raku
- Homepage:
- Size: 24.4 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
Awesome Lists containing this project
README
# Object::Permission
Experimental method (and public attribute accessor,) level authorisation for Raku objects.
![Build Status](https://github.com/jonathanstowe/Object-Permission/workflows/CI/badge.svg)
## Synopsis
use Object::Permission;
class Foo {
has $.baz is authorised-by('baz');method bar() is authorised-by('barbar') {
...
}
}
# Object::Permission::User is a role, just use type pun
$*AUTH-USER = Object::Permission::User.new(permissions => );my $foo = Foo.new;
$foo.bar(); # Executes okay
say $foo.baz; # Throws X::NotAuthorised## Description
This is an experimental module to provide a rudimentary authorisation
mechanism for classes whereby selected methods or public attribute
accessors can require a named permission to execute, the permissions
associated with the dynamic variable `$*AUTH-USER` being checked
at invocation and an exception being thrown if the User object does not
have the required permission.The intent is that `$*AUTH-USER` is initialised with an object
of some class that does the role `Object::Permission::User` which
populates the permissions as per the application logic.## Installation
Assuming you have a working Rakudo installation you should be able to install this with *zef* :
# From the source directory
zef install .# Remote installation
zef install Object::Permission
## Support
Suggestions/patches are welcomed via [github](https://github.com/jonathanstowe/Object-Permission/issues)
## Licence
This is free software.
Please see the [LICENCE](LICENCE) file in the distribution
© Jonathan Stowe 2015 - 2021