-
-
Notifications
You must be signed in to change notification settings - Fork 139
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
Issue with ignore_permission Flag in User Channel Management Hook #912
Comments
Can you share your code for the same? |
ContextFor each ERPNext project, I automatically create a corresponding Raven Channel. I have implemented a hook that listens to the Project update event. This hook is designed to manage the project's manager (User) association with the channel:
Error message is : ""You don't have permission to remove members from this channel"" Code Snippetsdef add_user_to_channel(channel, user, is_admin):
frappe.get_doc(
{
"doctype": "Raven Channel Member",
"channel_id": channel,
"user_id": user,
"is_admin": is_admin,
"last_visit": frappe.utils.now()
}
).insert(ignore_permissions=True)
def remove_user_from_channel(user, channel):
member_name = frappe.db.get_value('Raven Channel Member', {"user_id": user, "channel_id": channel}, 'name')
if member_name:
frappe.delete_doc('Raven Channel Member', member_name, ignore_permissions=True)
|
So the error is only thrown when trying to remove members right? We have a check in our controller to see if the user (from the current session) is a member of the channel or not. We can potentially check for the ignore_permissions flag I believe. |
There is also an error message when I try to add a new user. NB: this only happens when the channel is private. |
Hello,
I am currently using a hook to add and remove users to/from channels. However, I've encountered an issue where the
ignore_permission
flag does not seem to be functioning as expected.Could you please help me determine if there is a solution or workaround for this issue?
Thank you! 😊
The text was updated successfully, but these errors were encountered: