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

Events with modified canView permissions still show in Events list #88

Open
RuthAdele opened this issue Jan 21, 2016 · 2 comments
Open

Comments

@RuthAdele
Copy link
Contributor

I need to create events for specific security groups (who only have access to certain pages on the front end of the site). These events still show in the events list on the Calendar Page no matter whether you are logged in or not. Once you click on an event a 'you can't view this page' message is displayed, but since the bulk of the event details are displayed on the Calendar event list, this isn't really acceptable.

I think this is because the events call is a straight SQL query, instead of using Silverstripe's CalendarEvent::get() functionality.

For a quick fix, I'm adding <% if canView %> into my template. But I really loathe to do this.

Is a fix for this possible? I understand it may be a bit of work...

@unclecheese
Copy link
Owner

Yeah, this is a really tricky issue in a lot of SS applications (the SiteTree is a great example). I would recommend using the filterByCallback method on DataList. It's a huge performance hit, but I think it's cleaner than putting it on the template, mostly because you get a limited list, rather than hiding stuff with display logic, so your $Events.Count is accurate.

@RuthAdele
Copy link
Contributor Author

I would be happy to do this if I could do it without editing the source code of the module. We try to avoid that at all costs (using extensions instead), so that we can easily upgrade in the future.

I don't think I can add a filter to the Events call without modifying the module code, can I?

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

No branches or pull requests

2 participants