EssentialsX

EssentialsX

2M Downloads

sudo command request

Okervill opened this issue ยท 4 comments

commented

Hi there, i appreciate that the sudo command allows for a server admin/moderator to force another player to run a command.

Is it possible for the target player to run the command and bypass permissions?

For example if i do "/sudo user1 op user2" or "/sudo user1 repair" or something like that.

user1 will get the "no permissions" message despite it being an admin wanting the command ran

I ask because not all commands can be ran from the console and if i am unable to get online it would be nice to be able to help from the console by using the sudo command

commented

This could be done in theory by using Player#addAttachment, but EssentialsX would need to retrieve the permission for the command being run from the command's plugin. This wouldn't be an issue in theory, assuming the plugin registers its commands properly along with the permissions that it then checks for, but some plugins don't do this for one reason or another.

Also, we won't have an easy way of knowing for exactly how long the player will need the permission in order for the command to function properly - there might be delayed tasks with their own permission checks, for example.

commented

Heh, I was literally just thinking of this today. Since all commands are processed in sync a possible solution is a boolean assigned to the user that is set to true when they're being sudo'd. Then isAuthorised would always return true if that boolean is true.

commented

@SupaHam This would only work for EssentialsX commands though, although it might be easier than supporting the majority of plugins by attaching temporary perms that plugins may not register.

commented

Closing in favor of #2185, which contains much of the same discussion.