Conversation
@luacs1998: Could I get your input here? You're familiar with the Forge permission API. |
|
||
@Override | ||
public void registerNode(final String node, final DefaultPermissionLevel level, final String desc) { | ||
// TODO |
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 Sponge have the concept of registering permissions?
Still trying to acquaint myself with the Sponge PermissionService, so...
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.
We have the concept of creating descriptions which requires the mod/plugin, the permission node, and a description.
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.
To add on to this, descriptions can designate generic like permissions with placeholders for variable permissions. e.g. nucleus.teleport.world. to have per dimension permissions.
Looks okay to me, but if you want a second opinion - @LatvianModder? |
return false; | ||
} | ||
|
||
// TODO contexts? |
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.
How should we handle this? Sponge has a Context
concept as well, not sure if we want to convert IContext
data to a Context
?
|
||
@Override | ||
public Collection<String> getRegisteredNodes() { | ||
return Collections.emptySet(); // TODO |
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.
Should we keep track of this, just for Forge mods wishing to get this?
I guess this works. I wouldnt use that many lambdas in getNodeDescription, but that isn't used frequently anyway, so I guess its fine. Im ok, as long as it properly handles registered permissions. Only not sure why is that try{}catch{} required, just register your handler in PREINIT, and it will be fine, because mods are expected to register nodes in INIT+ |
try { | ||
PermissionAPI.setPermissionHandler(this); | ||
} catch (IllegalStateException ignored) { | ||
RegistryHelper.setFinalStatic(PermissionAPI.class, "permissionHandler", this); |
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.
This is bad, if setting the permission handler fails then log it to the console as that likely means someone else is doing so. Let the server admin figure out how to proceed but don't blindly blow away another mod whose purpose is to do permissions.
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.
No, I actually agree with Sponge being the strongest permission handler (Config option for this would be nice tho), but I dont agree with aggressively changing the private field. You only should set permission handler in PREINIT state, as I said earlier. Hopefully this is changed
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.
@luacs1998 also suggested that we be the strongest. There's the possibility that another mod will replace our handler, so my thought was to do it after pre-init. I can add a config option to disable our replacing of other permission handlers if one is registered before Sponge.
7367b6b
to
aaf4b9c
Compare
src/main/java/org/spongepowered/mod/service/permission/SpongePermissionHandler.java
Outdated
Show resolved
Hide resolved
aaf4b9c
to
48daccb
Compare
@kashike status of this? |
Yes, what’s the status on this? We still need a plugin for this. |
Bump... |
please add this....we need this implemented |
What exactly has to be tested? |
Correct |
So, I did that and (after I found out I have to enable this in the Sponge configuration) it works fine. I can give/deny the permissions registered by my mod using LuckPerms and they are correctly identified. Only issue is that, the default permission level passed to the registerNode method is ignored and instead the default permission level is undefined (which results in deny). However, since this has to be manually enabled anyway, I guess that is ok. |
you could already do so https://docs.spongepowered.org/stable/en/plugin/permissions.html#for-forge-mods you don't need this PR for that |
If I had known about this way before the Forge PermissionAPI PR was merged, I would have simply just added a hook in checkPermission() method for forge mods, which would make things 10000x easier. That's why I suggest to try this approach in 1.13/1.14+ and basically just not care about it in 1.12. Mods would most likely not care about it this late anyway, but if new PR was made for 1.13, maybe then things can change |
The Forge Permission API is pretty well used already on 1.12.2. So it would make sense to already implement it in API 7, so people don't have to use an unreleased version of an abandonned plugin that bridges the gap. |
@gabizou what's the holdup? This PR is a strict improvement of the project, has been confirmed to work and been reviewed by several people. |
@phit has objections to merging this and can elaborate why. |
Sure. Let's keep it rotting until it can't be merged anymore. |
5f57abf
to
dae5743
Compare
@BrainStone oy. No need to be rude. |
dae5743
to
90066af
Compare
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.
Tested with FTB Utilities.
Tried to change ftbutilities.chat.nickname.set
with Luckperms, everything is working as intended.
SpongeCommon | SpongeForge
#1049