Drupal core : 6.26
modules:
- Merci : 6.x-2.0
- Calendar : 6.x-2.4
- Date : 6.x-2.9
I modified the Calendar view (merci_reservation_calendar) in the Merci module, to be visible to users with the 'create reservations' permission. (changed access from 'manage reservations' to 'create reservations')
Now the Calendar view can be used by anyone who can make a reservation, to see if and when there are free slots.
Problem: The 'Add+' link on top of the calendar does not show unless a user has the 'administer nodes' permission.
Further digging in the code of the calendar module (theme/theme.inc, line 73) shows that the 'Add+' link is only displayed to a user with either the 'administer nodes' permission or 'create merci_reservations content' permission :
if (!empty($view->date_info->calendar_date_link)
&& (user_access("administer nodes") || user_access('create '. $view->date_info->calendar_date_link .' content'))) { Because the 'create merci_reservations content' permission does not exist, it can't be assigned to a role/user, so the only way of displaying the 'Add+' button is by assigning the 'administer nodes' permission, but I don't want to do that, because I would like to use the Calender view for anyone who can make a reservation, not just users with an administrating role.
Solution :
What do you think would be the best solution to solve this?
- add a 'create merci_reservations content' permission, which would basically have the same meaning as 'create reservations', but because they are different, make managing permissions a bit more difficult and error prone, because both permissions would have to be assigned to a user, to make everything work (showing the 'Add+' link and grant the permission to create a reservation)
- rename the 'create reservations' permission to 'create merci_reservations content' (and thus eliminating the double permission problem of the previous solution), but this would cause other issues in the MERCI module and the derivative modules.
- alter the calendar module so that the 'Add+' link is displayed if a user has the 'create reservations' permission. I'm not sure how this can be done best. Would it be possible to override the permissions check of 'Add+' link of the Calendar module, within the MERCI module? If this is possible, this would be the cleanest solution, because it doesn't change the default behavior of the original calendar module, and the current permissions of the MERCI module would not have to be changed.
Comments
Comment #1
darrick commentedI believe the permission you are looking for is "Reservation: Create new content". Under "Node".
Comment #2
darrick commentedComment #2.0
darrick commenteduse correct filename, add code snippet