The library gives you the possibility to secure your application and differentiate permission levels for users.
Here is a common client-side authentication technique:
To make your application more secure, you can repeat checking on the server side
The enumeration DHTMLX.Scheduler.Authentication.EditModes contains all the possible permission level values, which are:
The code below is an example of the client-side authentication. You should define the client-side authentication in the action that initializes, configures scheduler and returns the main view.
public ActionResult Index() {
var sched = new DHXScheduler(this);
...
if (Request.IsAuthenticated) {
var user = context.Users.SingleOrDefault(u => u.UserId == (Guid)Membership.GetUser().ProviderUserKey);
sched.SetUserDetails(user, "UserId", "user_id");
}
sched.SetEditMode(EditModes.OwnEventsOnly, EditModes.AuthenticatedOnly);
...
return View(sched);
}
A few notes about the above code:
The code below is an example of server-side authentication. You should define the server-side authentication into the action that retrieves and saves data, and determines that the response can be sent back to the client (CRUD logic).
public ContentResult Save(Event changedEvent, FormCollection actionValues) {
var action = new DataAction(actionValues);
if (this.Request.IsAuthenticated && changedEvent.user_id == (Guid)Membership.GetUser().ProviderUserKey)
{
// your CRUD logic
}
else
{
action.Type = DataActionTypes.Error;
}
return (new AjaxSaveResponse(action));
}