Skip to content
On this page

Permission System

Written on March 12, 2023

In V4 the permission system was based on numerical values that were used as bitwise operators.

This meant that the amount of permissions was based on an ever increasing set of numbers.

Here's how that looked before.

    NONE = 0,
    ADMIN = 2,
    MODERATOR = 4,
    VIP_BRONZE = 8,
    VIP_SILVER = 16,
    VIP_GOLD = 32

Now when you wanted someone to be an ADMIN but also a VIP_GOLD supporter you would add the two values together and that would be their permission.

That would be reflected in the database as the numerical value 34.

Why I changed it

When you go to read the Database, you have no understanding of what they actually have as far as permissions go without having context of the core programming of the framework.

I moved away from bitwise functions entirely for the V5 permission structure to make it more human readable.

So instead of doing numerical representations of numbers, we are now doing an array of strings.

Which one do you think is more human readable?


VIP_GOLD + ADMIN permission is: 34


VIP_GOLD + ADMIN permission is: ['admin', 'vip_gold']

Character & Account Permissions

On top of this I also introduced this new permission structure for both individual accounts and characters.

This allows for specific permissions to exist for a whole account, and specific permissions to be introduced for a single character.

This means if we have a character permission called police and an interaction point requires the permission of police to be present, then we can add that to a characater.

Then we can restrict any functionality that we build with this new permission system.

It is just the better option for the long haul.

Created by Stuyk | Est. 2020