We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Restrict individual resources for users

Hi,
I'm presently evaluating the schedule control. I am wondering if I might be able to restrict individual resources for particular users.

Say you have a group of a number of conference rooms

1st floor
  - room 101
  - room 102
2nd floor
  - room 201
  - room 202

User 1 may have the right to book any room, User 2 may only book 1st floor, User 3 only second floor, and User 4 may only ever book room 102 for example. I couldn't see how to make individual resources "read-only", from what I could see only the whole schedule could be read-only or not.
The only way I can see is to manipulate the add-event controller, and do the checking there.
How would you approach this, might you have another idea?

Thank you for any suggestion.

3 Replies

KK Karthigeyan Krishnamurthi Syncfusion Team March 16, 2017 01:11 PM UTC

Hi Stefan, 
 
Thank you for contacting Syncfusion support. 
 
We can achieve your requirement by adding extra field in an appointment window and for the same we have prepared the sample which can be download from the below location. 
 
In the sample, additional information regarding user type is saved with an appointment and based on that information CRUD operation is prevented for specific users on specific room. Kindly refer the below code example used in the sample. 
 
<Code> 
function onAppointmentWindowOpen(args) { 
        if ($(".customfields").length == 0) { 
            var customDesign = "<tr class='customfields'><td class='e-textlabel'>User Type</td><td><input name='UserType' class='usertype' type='text'/></td></tr>"; 
            $("." + this._id + "parrow").after(customDesign); 
        } 
        if (!ej.isNullOrUndefined(args.appointment)) { 
            // if double clicked on the appointments, retrieve the custom field values from the appointment object and fills it in the appropriate fields.        
            $(".usertype").val(args.appointment.UserType); 
        } 
        else { 
            // if double clicked on the cells, clears the field values.                
            $(".usertype").val(""); 
        } 
        } 
function onBeforeAppointmentCreate(args) { 
        var app = (ej.isNullOrUndefined(args.appointment[0])) ? args.appointment : args.appointment[0]; 
        if (app.UserType == "User2" && app.RoomId != 1) 
            args.cancel = true; 
        if(app.UserType == "User3" && app.RoomId != 2) 
            args.cancel = true; 
        if (app.UserType == "User4" && app.OwnerId != 12) 
            args.cancel = true; 
        } 
</Code> 
 
Regards, 
Karthigeyan 
 
 
 



ST Stefan March 19, 2017 11:41 AM UTC

Hi Karthigeyan,

thank you very much for your response, I shall try this out and report back - it may take a little while since I'm only now getting acquainted with the software.

One thing I have to say: I am thoroughly impressed by your controls, the availability of the community license, and the way you handle support. The last I expected to get is a sample that focuses on my exact need, what a fantastic surprise! You are fantastic, and I shall find a way to contribute to your company in the future by whichever means available.
Thank you
Stefan


KK Karthigeyan Krishnamurthi Syncfusion Team March 20, 2017 08:34 AM UTC

Hi Stefan,  
 
Thank you for being with us. 
 
We will wait to hear from you. 
 
Regards, 
Karthigeyan 


Loader.
Up arrow icon