Razish / japp

JA++ server and client modification for Jedi Academy
GNU General Public License v2.0
44 stars 30 forks source link

Fixing the Privilege Bitfield #367

Closed Dexter4637 closed 8 years ago

Dexter4637 commented 8 years ago

Can you guys fix the Privilege Bitfield which is limited to 32 commands and make it higher up to 64 or more, if possible? The jSON code wont work with uint64_t, and needs to be fixed too somehow. Thanks

ensiform commented 8 years ago

Do you really need shit loads of more? Can't they be added through lua?

I'd say it might be better to do away with the privileges as bitfields and use something else like a C++ map or something. Or alternate identifier like enum?

Razish commented 8 years ago

use something else like a C++ map

The current code works great, the serialisation and management is the real issue.

Potential fix 1: Have the permissions list as a whitespace-delimited list of strings. This requires some tools to do the following: add, remove, test if exists, prevent duplicates It's generally not a cost-effective solution

Potential fix 2: Add uint32_t altPrivs and serialise to two JSON fields. Keep adding onto the existing list of defines, adjust the permissions checking function to shift + mask if above UINT32_MAX / std::numeric_limits<uint32_t>::max()

Potential fix 3: Move to uint64_t privs and if there is no 64 bit support for JSON or the cJSON API then serialise to two JSON fields. Reconsider atoi usage for 64 bit integer support and general usage

I'm leaning toward fix 3 for now, and if we ever somehow run into that limit, then some storage mechanism of a list of allowed cmds (as strings) will be suitable.

ensiform commented 8 years ago

The cJSON on the repo currently has no 64bit integer functions.