Skip to content
steinhaugPublic

About

User Access, Roles, Permissions and Configurations framework Tools for administering user access.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

UARPC - User Access, Roles, Permissions and Configurations

UARPC is a PHP library that provides a flexible and easy-to-use framework for managing user access control. It allows you to define roles and permissions, assign roles to users, and check if a user has a specific permission.

1. INSTALL

To install the library, use Composer:

composer require steinhaug/uarpc

Getting Started

To start using UARPC, you need to initialize the uarpc and UARPC_base classes:

require 'vendor/autoload.php';

// Initialize the uarpc class to ensure all required files are loaded
new uarpc(); // DB_PREFIX

// Create a new UARPC_base instance with a user ID
$uarpc = new UARPC_base($userID);

2. DOCUMENTATION

Basic Usage

Here's a simple example of how to use UARPC to manage roles and permissions:

// Create a new role
$roleID = $uarpc->roles->add('Administrator', 'This is the administrator role');

// Create a new permission
$permissionID = $uarpc->permissions->add('create-post', 'Allows a user to create a new post');

// Assign the permission to the role
$uarpc->permissions->assign($permissionID, $roleID);

// Assign the role to a user
$uarpc->roles->assign($roleID, $userID);

// Check if the user has the permission
if ($uarpc->havePermission('create-post', $userID)) {
    echo 'The user has permission to create a post.';
} else {
    echo 'The user does not have permission to create a post.';
}

3. BRIEF HISTORY LOG

See the commit log for updates.

UARPC v1.7.0

  • Upgraded steinhaug/mysqli to v1.9
  • Adding tests

UARPC v1.6.5

  • Updated readme.

UARPC v1.6.4

  • Added $GLOBALS['steinhaugUarpcDbPrefix'] for all classes.

UARPC v1.6.3

  • Fixed composer requirements.

UARPC v1.6.2

  • Added UserID parameter so it's possible to check against any user.
    ->havePermission(PermTitle, UserID),

UARPC v1.6.1

  • Moved Mysqli2 into seperate project

4. Information

4.1 License

This project is licensed under the terms of the MIT License. Enjoy!

4.2 Author

Kim Steinhaug, steinhaug at gmail dot com.

Sosiale lenker: LinkedIn, SoundCloud, Instagram, Youtube, X, Ko-Fi, Github, Gitlab

Generative AI lenker: Udio, Suno, Huggingface

Resurser og hjelpesider: Linktr.ee/steinhaugai, Linktr.ee/stainhaug, pinterest/steinhaug, pinterest/stainhaug

About

User Access, Roles, Permissions and Configurations framework Tools for administering user access.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages