mattermost-community / mattermost-plugin-welcomebot

Apache License 2.0
66 stars 41 forks source link

[GH-41] Restrict Channel specific Welcome Bot message config to users who have permission to manage channels #78

Closed maisnamrajusingh closed 1 year ago

maisnamrajusingh commented 3 years ago

Summary

Adds Restriction to Channel Messages

Ticket Link

Fixes https://github.com/mattermost/mattermost-plugin-welcomebot/issues/41

mattermod commented 3 years ago

Hello @maisnamrajusingh,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

jasonblais commented 3 years ago

@maisnamrajusingh please see feedback above

maisnamrajusingh commented 3 years ago

@maisnamrajusingh please see feedback above

will work on the update based on the discussion yesterday.

maisnamrajusingh commented 3 years ago

@hanzei @jasonblais @mickmister Would using the following api methods be enough to lock the permissions?

//for public channel
p.API.HasPermissionToChannel(userID, channelID, model.PERMISSION_MANAGE_PUBLIC_CHANNEL_PROPERTIES)

//for private channel
p.API.HasPermissionToChannel(userID, channelID, model.PERMISSION_MANAGE_PRIVATE_CHANNEL_PROPERTIES)

or is there a better way to access the permissions ?

mickmister commented 3 years ago

@hanzei @jasonblais @mickmister Would using the following api methods be enough to lock the permissions?

//for public channel
p.API.HasPermissionToChannel(userID, channelID, model.PERMISSION_MANAGE_PUBLIC_CHANNEL_PROPERTIES)

//for private channel
p.API.HasPermissionToChannel(userID, channelID, model.PERMISSION_MANAGE_PRIVATE_CHANNEL_PROPERTIES)

or is there a better way to access the permissions ?

@maisnamrajusingh looks good to me :+1:

jasonblais commented 3 years ago

@maisnamrajusingh has all feedback from reviewers been addressed?

maisnamrajusingh commented 3 years ago

@hanzei @jfrerich I have updated the logic to check If the user has the following permission PERMISSION_MANAGE_SLASH_COMMANDS I am assuming here that the admin automatically has the permission to execute this command.

maisnamrajusingh commented 3 years ago

@hanzei I have updated the logic to address the issue you highlighted, can you take a look ?

mickmister commented 3 years ago

@deepakdemiwal I submitted feedback here

mattermod commented 3 years ago

This PR has been automatically labelled "stale" because it hasn't had recent activity. A core team member will check in on the status of the PR to help with questions. Thank you for your contribution!

/cc @jasonblais @jfrerich @emilyacook

maisnamrajusingh commented 3 years ago

@mickmister just looking into this today. Got sidelined because of the confusion. I'll send you an update on this. Will post any questions if any here.

maisnamrajusingh commented 3 years ago

@mickmister just looking into this today. Got sidelined because of the confusion. I'll send you an update on this. Will post any questions if any here.

done with the changes you asked for. Let me know if you need the steps for the QA

D0miH commented 1 year ago

Any updates on this? This would be a very useful feature imo as users could create custom welcome messages in their channels without having to have the system_admin role.

mickmister commented 1 year ago

@D0miH Thanks for commenting here :+1:

I'm closing this PR as it's abandoned as they have since left the organization. I'm queuing it up for work here https://github.com/mattermost/mattermost-plugin-welcomebot/issues/41