Active
Project:
Chatroom
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
1 Dec 2009 at 23:45 UTC
Updated:
19 Jun 2010 at 21:38 UTC
Jump to comment: Most recent
Justin,
it would be nice to have a role based access control for private chats.
Tormi
Comments
Comment #1
Anonymous (not verified) commentedcare to flesh out how that might work a bit more?
i'm not opposed to that feature at all.
Comment #2
tormiI was thinking about a possibility to use a role for granting a group access to the private chat instead of username(s). But maybe it's easier to use og group for that instead.
Tormi
Comment #3
Anonymous (not verified) commentedyeah, that is probably best done with OG. part of the reason behind moving chats to nodes was to allow easy integration with OG.
i'll leave this open in case anyone else chimes in, but i probably wont work on this in the short term.
Comment #4
victorlf commentedWould it be easy to have Taxonomy Access Control control the access to chats?
I thouht i would work right away, but didn't. Anyone knows what should be done?
Comment #5
Anonymous (not verified) commentedi've never used Taxonomy Access Control - what mechanism does it use? feels like it should work out of the box, as chats and chatrooms are nodes...
Comment #6
victorlf commentedI'll explain how I got chats only accessible to certain roles. The solution is certainly not perfect, but I don't know how to do it better, and it just works. It's a solution for my particular case.
First - hook_access in chatroom always return TRUE or FALSE, which doesn't allow other content access control. I just replaced two functions:
What's important in this replacement is to delete the 'view' permission, but in my case I could just delete everything.
This leaves all control to TAC. Just add Chat Rooms and Chats to a Taxonomy vocabulary, assign each Chat Room and Chat a (or many) taxonomy terms, and specify in Taxonomy Access Permissions the rules.
Second - to show in a Chat Room list only the Chats that can be viewed, I added in hook_view:
This skips the visualization of chats which can't be viewed. I don't think this is quite efficient, because it has to load each chat. This can't be done in hook_load because it causes an infinite loop of loads. Maybe it could be done more efficiently only accessing some node content (Views does it) but I don't know how this could be done.
I think something should change in the module to be able to do this by default, but some research should be done to find the cleanest and most efficient way of doing it.
Comment #7
Anonymous (not verified) commentedi'll look into making chat and chatroom node types return NULL when appropriate in hook_access, thanks for the feedback.
Comment #8
jmaguniaLooking at preliminary testing, Victor's solution worked for me. I wasn't having an issue with Taxonomy Access Control, but with UC Node Access. After purchase customer's were still not having access. After replacing the hook_access functions, content access started working as it should for the chats.