TeamUlysses / ulib

ULib: A Lua library for more rapid development on Garry's Mod servers
http://ulyssesmod.net
Other
104 stars 55 forks source link

Migrate UCL user store from flat file to SQLite. #74

Closed JoshPiper closed 2 years ago

JoshPiper commented 3 years ago

Possibly fixes #38.

This prevents an entire file being rewritten for singular changes, and instead hands it off to the sqlite engine to handle instead. Includes utility functions for saving individual users, all users, and deleting of the same.

I've tried to handle errors where possible, and re-use existing structures (ie, the user checks). I've also tried to remain in the same style, though I suspect I've missed some parts, since it's not my normal style.

There has been some testing carried out, on a srcds instance with myself and a bot, though I would suggest code review and further testing prior to merging.

json was chosen as the storage medium for allow/deny rights, as the old function was causing newline(?) issues when inserting. Otherwise, the structure has been left as-is. If required, this can be changed to be an access rights table, but I suspect that'd be overkill for this project.

The groups file has been left as-is, this only changes the user storage, as that was the focus for #38.