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 contextual permissions to limit users access to certain channels #46

Closed

Conversation

burdoto
Copy link
Contributor

@burdoto burdoto commented Mar 19, 2024

This PR adds per-command-and-channel permissions for most commands, so that through permission management plugins, Administrators can limit access for users to certain channels; such as staff channels.

Copy link
Member

@Yann151924 Yann151924 left a comment

Choose a reason for hiding this comment

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

A little change in the code :)

Please update the readme to reflect the change.

@@ -90,6 +91,10 @@ public void defaultCommand(AurionChatPlayer aurionChatPlayer){

public boolean execute(AurionChatPlayer aurionChatPlayer, String channel, Action action) {
try {
String perm = "aurionchat.channel." + action.name().toLowerCase() + "." + channel;
Copy link
Member

Choose a reason for hiding this comment

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

I think it will be better to rewrite the function checkChannelExist and launch this function directly here and remove the usage in the "sub function" leave/join/spy to directly if the channel exist and the player permission

In this project i don't centralize even futher the command in the common so there is a little bit of work in forge and fabric since the command suggest all the channel (tab completion)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, consistent tab completion was not really in my priorities here for the moment.
I'm afraid I'm not quite sure what you mean though; the checkChannelExists call always precedes this code; so its never skipped nor is there false-positive error messages. Am I missing something?

@Yann151924
Copy link
Member

Yann151924 commented Mar 24, 2024

I made the change, maybe i was confusing when explaining :D. I just change the permission for alllisten to aurionchat.channel.alllisten

Edit: for now i don't handle the tab completion but i need to rewrite part of the code to have something better to handle this for all platform. I have already made this kind of work in other project :)

@burdoto burdoto deleted the add-contextual-permissions branch March 24, 2024 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants