search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Only allow users to edit their own events

Asked by Anonymous
17 years ago.

I am using the Scheduler asa shared calendar for booking resources. So I don't want one user to be able to edit another's bookings. Is there a way to go aboutdoing this?

Thanks!

Comment posted by Dan Letecky
17 years ago.
This should be solved on the data or application layer. You should pass only the events that should be displayed in your data source.

Typically, you will use User.Identity.Name as one of the parameters for the selecting stored procedure. That stored procedure will load just the events that are visible to the specified user.
Comment posted by Martin R.
17 years ago.
Maybe you want to add a tag to the event that tells you if the event is editable. Then you can check if the event is editable either in your custom JS-action or server side.
E.g.
if e.tag("editable") = 1
{ do it... }
Comment posted by Dan Letecky
17 years ago.
Oh, I see I missed the point.

It's possible to do it on the client as Martin suggests. It's also possible to turn off the actions per individual event in BeforeEventRender event handler:

    protected void DayPilotScheduler1_BeforeEventRender(object sender, DayPilot.Web.Ui.Events.BeforeEventRenderEventArgs e)
{
if (e.Tag["editable"] != "1")
{
e.EventClickEnabled = false;
}
}
This will disable event clicking. The property e.EventEditEnabled is not yet available but it will be available in DayPilot 4.0.
Comment posted by Martin R.
17 years ago.
This would also be interesting for the context menu, so someone can disable the whole context menu and even a special link in the context menu. E.g. if not editable the context menu shows view only, if editable it shows view and edit.
Comment posted by Dan Letecky
17 years ago.
This is already possible: You can specify custom context menu using BeforeEventRender event handler. In DayPilotCalendar you can disable right click at all (and that will disable context menu as well). I'm not sure if specifying null context menu disables it or not. However, I will add support for right click disabling to DayPilotScheduler as well.
Comment posted by Russ S.
17 years ago.

For a simple solution, I save the user id (user.name.identity) in the event table. If a user attempts to edit an event, the sub checks the user id based on the event id through a stored procedurefor a match. If no match, the calendar is refreshed with no changes. If there is a match, changes are made and calendar is refreshed.This does require a post back. With roles, you can also allow a certain group access to edit any event.

We use this for scheduling conference rooms and it works great. I just wish we had the ability to keep overlapping from happening.

Comment posted by Dan
15 years ago.

"The property e.EventEditEnabled is not yet available "

any news on this?

Is it possible (now or in future) to have some events editable and others have the onclick/ondoubleclick handled?

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.