Your twAccessHotel class has nothing to do with MODx Resources; protecting those would still be done with Resource Groups. Or am I misunderstanding your question?
-
- 74 Posts
Sorry, my question was rather vague. I protected a Resource (document) in manager with the access permissions. The protection has nothing to do with my twAccessHotel.
Within this protected Resource I’ve my Snippet which contains the getCollection(). When I login (frontend) and go to this Resource, the Snippet doesn’t return any Hotels. But when the Resource is unprotected I get all the Hotels.
I hope you understand my problem.
-
- 74 Posts
That’s the funny thing. I always use a different browser for front-end viewing.
That’s what I have:
– A resource (hotel list) which is accessible for Resource Group: Clients
– A user which is allowed to access the Resource Group: Clients
– The twHotel-thing which shows the database-records based on the user that is logged in (is called within a snippet that is placed in resource (hotel list))
Now, when I log in and go to the resource (hotel list) I don’t get any hotels. When I take a look at the session information, the twAccessHotel-session is empty... I don’t have an idea why. Because when I make the resource (hotel list) public I get the hotel entries assigned to my user-login.
Why is twAccessHotel empty? Is it because the attributes were already loaded without twAccessHotel and it doesn’t reload it properly?
If I add $modx->user->getAttributes(’twHotel’, ’web’, true) at the top of the snippet again, it works...
-
- 24,544 Posts
Quote from: mt85 at May 27, 2010, 01:34 PM
That’s what I have:
– A resource (hotel list) which is accessible for Resource Group: Clients
– A user which is allowed to access the Resource Group: Clients
– The twHotel-thing which shows the database-records based on the user that is logged in (is called within a snippet that is placed in resource (hotel list))
Now, when I log in and go to the resource (hotel list) I don’t get any hotels. When I take a look at the session information, the twAccessHotel-session is empty... I don’t have an idea why. Because when I make the resource (hotel list) public I get the hotel entries assigned to my user-login.
Why is twAccessHotel empty? Is it because the attributes were already loaded without twAccessHotel and it doesn’t reload it properly?
If I add $modx->user->getAttributes(’twHotel’, ’web’, true) at the top of the snippet again, it works...
It’s really hard to say without more information.
Did you change any policies?
Did you use the "administrator" policy for your Context Access ACL entries and the "resource" policy for your Resource Group Access ACL entries?
Does your snippet perform any manager actions?