New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewriting permission system to use UUIDs and Ranks #1290
Conversation
m_DB("Ranks.sqlite", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) | ||
{ | ||
// Create the DB tables, if they don't exist: | ||
m_DB.exec("CREATE TABLE IF NOT EXISTS Rank (RankID, Name, MsgPrefix, MsgPostfix, MsgNameColorCode)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does SQLite specify a default type? I thought you had to specify one when creating tables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SQLite doesn't care about types much, you can store just about any datatype in any column. It has some little preferences ("affinity"). By default the fields tend to be of "string" type, which suits us for most.
Shouldn't |
Yup, you're right |
"Group" is SQL keyword and shouldn't be used as table name.
I'm not sure if I'm doing this right. The SQL seems clunky. |
The SQL looks normal for a fully normalised database. |
The test code, as it is now, doesn't do as much checking, it's more like only for seeing if the code even works. Do you think it'd be worth to keep it as a test? It'd be easier to make the test into a plugin, once all the functions are Lua-exported. |
Its more that once we have one test it becomes massively easier to write more for that class as the hard part of getting it to compile separately is done. |
Also firing up the server to run a test is expensive so I think it is better to have the tests outside plugins where possible. |
These will read consecutive values off the stack, each value of a type independent of the other values. Auto-generated because we don't have variadic templates in C++03.
ToLua generated an extra return value for GetHTMLEscapedString() and GetURLEncodedString(), making them difficult to use.
Gentlemen, I'd like your comments on the cRankManager API - do you think it's okay? Is there anything missing? See the Core PR cuberite/Core#83 for an example usage of the API. |
I took a quick look, and I think it's great. |
|
||
// Get the permissions: | ||
AString MsgPrefix, MsgSuffix, MsgNameColorCode; | ||
cRoot::Get()->GetRankManager().GetPlayerMsgVisuals(PlayerUUID, MsgPrefix, MsgSuffix, MsgNameColorCode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unchecked return value
ToLua would generate a shadow return value for the input strings.
I think this is now feature-complete. Anyone up for reviewing this whole lot? |
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6 instead of 5 empty lines?
You're being really thorough :) |
Oh, the default rank is not being applied, yet. Gotta fix that. |
Rewriting permission system to use UUIDs and Ranks
Does git already download the latest version of the Core or do we need to update the submodule? |
I have no idea. I've updated the Core reference in the branch, so theoretically it should give you the updated version, but then the Core branch has been merged afterwards, so it won't be the merged branch, it'll be the Ranks branch just before merging. Best to update manually :) |
I just downloaded it and it gave the latest version :) |
As outlined in the forum http://forum.mc-server.org/showthread.php?tid=1540 , this PR changes the permission system to use UUIDs instead of playernames, and at the same time is refactored to use SQLite for the storage, and an entire new set of API for management.
cMojangAPI
update the cached PlayerNames in the ranks