semvec/pypi-packages huggingface dataset:
casbin-redis-adapter 1.5.0
Redis Adapter for PyCasbin
License: Apache 2.0
Requires Python: >=3.8
Keywords: casbin, Redis, casbin-adapter, rbac, access control, abac, acl, permission

Redis Adapter for PyCasbin
====

[![build](https://github.com/officialpycasbin/redis-adapter/actions/workflows/build.yml/badge.svg)](https://github.com/officialpycasbin/redis-adapter/actions/workflows/build.yml)
[![Coverage Status](https://coveralls.io/repos/github/officialpycasbin/redis-adapter/badge.svg)](https://coveralls.io/github/officialpycasbin/redis-adapter)
[![Version](https://img.shields.io/pypi/v/casbin_redis_adapter.svg)](https://pypi.org/project/casbin_redis_adapter/)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/casbin_redis_adapter.svg)](https://pypi.org/project/casbin_redis_adapter/)
[![Pyversions](https://img.shields.io/pypi/pyversions/casbin_redis_adapter.svg)](https://pypi.org/project/casbin_redis_adapter/)
[![Download](https://static.pepy.tech/badge/casbin_redis_adapter)](https://pypi.org/project/casbin_redis_adapter/)
[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord&label=discord&color=5865F2)](https://discord.gg/S5UjpzGZjN)

Redis Adapter is the [Redis](https://redis.io/) adapter for [PyCasbin](https://github.com/casbin/pycasbin). With this library, Casbin can load policy from redis or save policy to it.

## Installation

```
pip install casbin_redis_adapter
```

## Simple Example

```python
import casbin_redis_adapter
import casbin

adapter = casbin_redis_adapter.Adapter('localhost', 6379)

e = casbin.Enforcer('path/to/model.conf', adapter, True)

sub = "alice"  # the user that wants to access a resource.
obj = "data1"  # the resource that is going to be accessed.
act = "read"  # the operation that the user performs on the resource.

if e.enforce(sub, obj, act):
    # permit alice to read data1casbin_sqlalchemy_adapter
    pass
else:
    # deny the request, show an error
    pass
```

## Configuration

`Adapter()` enable decode_responses by default and supports any Redis parameter configuration.

To use casbin_redis_adapter, you must provide the following parameter configuration

- `host`: address of the redis service
- `port`: redis service port

The following parameters are provided by default

- `db`: redis database, default is `0`
- `username`: redis username, default is `None`
- `password`: redis password, default is `None`
- `key`: casbin rule to store key, default is `casbin_rules`

For more parameters, please follow [redis-py](https://redis.readthedocs.io/en/stable/connections.html#redis.Redis)

### Getting Help

- [PyCasbin](https://github.com/casbin/pycasbin)

### License

This project is licensed under the [Apache 2.0 license](LICENSE).
redis-watcher 1.8.0
Casbin role watcher to be used for monitoring updates to policies for PyCasbin
License: Apache 2.0

# redis-watcher

[![build](https://github.com/officialpycasbin/redis-watcher/actions/workflows/release.yml/badge.svg)](https://github.com/officialpycasbin/redis-watcher/actions/workflows/release.yml)
[![Coverage Status](https://coveralls.io/repos/github/officialpycasbin/redis-watcher/badge.svg)](https://coveralls.io/github/officialpycasbin/redis-watcher)
[![Version](https://img.shields.io/pypi/v/redis-watcher.svg)](https://pypi.org/project/redis-watcher/)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/redis-watcher.svg)](https://pypi.org/project/redis-watcher/)
[![Pyversions](https://img.shields.io/pypi/pyversions/redis-watcher.svg)](https://pypi.org/project/redis-watcher/)
[![Download](https://static.pepy.tech/badge/redis-watcher)](https://pypi.org/project/redis-watcher/)
[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord&label=discord&color=5865F2)](https://discord.gg/S5UjpzGZjN)

redis-watcher is the [Redis](https://github.com/redis/redis) watcher for [pycasbin](https://github.com/casbin/pycasbin). With this library, Casbin can synchronize the policy with the database in multiple enforcer instances.

## Installation

    pip install redis-watcher

## Simple Example

```python
import os
import casbin
from redis_watcher import new_watcher, WatcherOptions

def callback_function(event):
    print("update for remove filtered policy callback, event: {}".format(event))

def get_examples(path):
    examples_path = os.path.split(os.path.realpath(__file__))[0] + "/../examples/"
    return os.path.abspath(examples_path + path)

if __name__ == "main":
    test_option = WatcherOptions()
    test_option.host = "localhost"
    test_option.port = "6379"
    test_option.channel = "test"
    test_option.ssl = False
    test_option.optional_update_callback = callback_function
    w = new_watcher(test_option)
    
    e = casbin.Enforcer(
        get_examples("rbac_model.conf"), get_examples("rbac_policy.csv")
    )
    e.set_watcher(w)
    # then the callback function will be called when the policy is updated.
    e.save_policy()
   
```

## Getting Help

- [pycasbin](https://github.com/casbin/pycasbin)

## License

This project is under Apache 2.0 License. See the [LICENSE](LICENSE) file for the full license text.
sqlobject-adapter 0.5.0
SQLObject Adapter for PyCasbin
License: Apache 2.0
Requires Python: >=3.4
Keywords: casbin, SQLObject, casbin-adapter, rbac, access control, abac, acl, permission

SQLObject Adapter for PyCasbin
====

[![GitHub Action](https://github.com/officialpycasbin/sqlobject-adapter/workflows/build/badge.svg)](https://github.com/officialpycasbin/sqlobject-adapter/actions)
[![Coverage Status](https://coveralls.io/repos/github/officialpycasbin/sqlobject-adapter/badge.svg)](https://coveralls.io/github/officialpycasbin/sqlobject-adapter)
[![Version](https://img.shields.io/pypi/v/sqlobject_adapter.svg)](https://pypi.org/project/sqlobject_adapter/)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/sqlobject_adapter.svg)](https://pypi.org/project/sqlobject_adapter/)
[![Pyversions](https://img.shields.io/pypi/pyversions/sqlobject_adapter.svg)](https://pypi.org/project/sqlobject_adapter/)
[![Download](https://static.pepy.tech/badge/sqlobject_adapter)](https://pypi.org/project/sqlobject_adapter/)
[![License](https://img.shields.io/pypi/l/sqlobject_adapter.svg)](https://pypi.org/project/sqlobject_adapter/)

SQLObject Adapter is the [SQLObject](http://www.sqlobject.org/index.html) adapter for [PyCasbin](https://github.com/casbin/pycasbin). With this library, Casbin can load policy from SQLObject supported database or save policy to it.

The current supported databases are:

- PostgreSQL
- MySQL
- SQLite
- Microsoft SQL Server
- Firebird
- Sybase
- MAX DB
- pyfirebirdsql

## Installation

```
pip install sqlobject_adapter
```

## Simple Example

```python
import sqlobject_adapter
import casbin

adapter = sqlobject_adapter.Adapter('sqlite:///test.db')

e = casbin.Enforcer('path/to/model.conf', adapter, True)

sub = "alice"  # the user that wants to access a resource.
obj = "data1"  # the resource that is going to be accessed.
act = "read"  # the operation that the user performs on the resource.

if e.enforce(sub, obj, act):
    # permit alice to read data1casbin_sqlalchemy_adapter
    pass
else:
    # deny the request, show an error
    pass
```


### Getting Help

- [PyCasbin](https://github.com/casbin/pycasbin)

### License

This project is licensed under the [Apache 2.0 license](LICENSE).
casbin-rabbitmq-watcher 1.7.0
Casbin role watcher to be used for monitoring updates to policies for PyCasbin
License: Apache 2.0
Requires Python: >=3.5
Keywords: pycasbin, casbin, Rabbitmq, casbin-watcher, rbac, access control, abac, acl, permission

# rabbitmq-watcher

[![Build Status](https://github.com/officialpycasbin/rabbitmq-watcher/actions/workflows/build.yml/badge.svg)](https://github.com/officialpycasbin/rabbitmq-watcher/actions/workflows/build.yml)
[![Coverage Status](https://coveralls.io/repos/github/officialpycasbin/rabbitmq-watcher/badge.svg)](https://coveralls.io/github/officialpycasbin/rabbitmq-watcher)
[![Version](https://img.shields.io/pypi/v/casbin-rabbitmq-watcher.svg)](https://pypi.org/project/casbin-rabbitmq-watcher/)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/casbin-rabbitmq-watcher.svg)](https://pypi.org/project/casbin-rabbitmq-watcher/)
[![Pyversions](https://img.shields.io/pypi/pyversions/casbin-rabbitmq-watcher.svg)](https://pypi.org/project/casbin-rabbitmq-watcher/)
[![Download](https://static.pepy.tech/badge/casbin-rabbitmq-watcher)](https://pypi.org/project/casbin-rabbitmq-watcher/)
[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord&label=discord&color=5865F2)](https://discord.gg/S5UjpzGZjN)

Rabbitmq Watcher is the rabbitmq watcher for pycasbin. With this library, Casbin can synchronize the policy with the database in multiple enforcer instances.

## Installation

```bash
pip install casbin-rabbitmq-watcher
```

## Simple Example

```python
import os

import casbin
from casbin_rabbitmq_watcher import new_watcher


def get_examples(path):
    examples_path = os.path.split(os.path.realpath(__file__))[0] + "/../examples/"
    return os.path.abspath(examples_path + path)


def update_callback_func(msg):
    ...


watcher = new_watcher()
watcher.set_update_callback(update_callback_func)

e = casbin.Enforcer(
    get_examples("rbac_model.conf"), get_examples("rbac_policy.csv")
)

e.set_watcher(watcher)
# update_callback_func will be called
e.save_policy()
```

## Getting Help

- [Casbin](https://github.com/casbin/pycasbin)

## License

This project is under Apache 2.0 License. See the [LICENSE](LICENSE) file for the full license text.