Skip to content
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

Add basic_priv property to privileges #3976

Closed
wants to merge 1 commit into from

Conversation

rubenwardy
Copy link
Member

Privileges players could grant with basic_privs was previously hard coded. This change makes it no longer hard coded.

minetest.register_privilege("interact", {
    description = "Can interact with things and modify the world",
    basic_priv = true
})

@est31
Copy link
Contributor

est31 commented Apr 9, 2016

👍

@ObaniGemini
Copy link

I would love to see this in 0.4.14 release

@Ekdohibs
Copy link
Member

Ekdohibs commented Apr 9, 2016

👍

local def = core.registered_privileges[priv]
if def then
if not def.basic_priv
and not core.check_player_privs(name, {privs=true}) then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It must be broken to newline after and not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not after and not, but after and.

@rubenwardy
Copy link
Member Author

Fixed some code style

local def = core.registered_privileges[priv]
if def then
if not def.basic_priv and
not core.check_player_privs(name, {privs=true}) then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guidelines say you should break after the operator, not is an operator.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it doesn't. Also, this is consistent with the rest of the file, and is more readable.
Even if it were so:

Note that these are only guidelines for more readable code. In some (rare) cases they may result in less readable code. Use your best judgement.

http://dev.minetest.net/Lua_code_style_guidelines

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not is not a binary operator, it's a unary operator.
Good to have the cleared up, I guess :D

@PilzAdam
Copy link
Contributor

PilzAdam commented Apr 9, 2016

Wouldn't it be best if this was a minetest.conf setting? After all, it's up the server owner to decide what their "admins" (i.e. players with the basic priv) are allowed to do.

@rubenwardy
Copy link
Member Author

#3977

@rubenwardy rubenwardy closed this Apr 9, 2016
@est31 est31 mentioned this pull request Apr 9, 2016
@rubenwardy rubenwardy deleted the basic_privs branch December 12, 2016 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants