This is a migrated thread and some comments may be shown as answers.

Appointment based security

3 Answers 77 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
AndyRutter
Top achievements
Rank 2
AndyRutter asked on 22 Mar 2009, 08:41 PM
Hi,
I am just trying to use the scheduler for the first time.
My client has a need to allow it's members use of 4 rooms.
I have set this up in a database and can add, edit, delete and move appointments around in the rooms etc no problem.
However at the moment all users can modify all appointments.
Is there a way to restrict editing and movement of appointments to the person that created it (and an admin user)

Scenario:
User B wants to use room A at 12PM, he signs on but sees that User A already has the room booked at that time.

At the moment User B can just move User A's appointment and insert their own.

I am assuming I will have to write custom code that grabs the creating, modifying and moving events and tests if the current user is the user that created the appointment and if not cancel it?

Just want to check there is not any unbuilt functionality or examples of this type of code (I cant be the first person to want this) before I start writing anything.
Only bought the controls a few days ago so still familiarizing myself so sorry if I have asked something obvious.

3 Answers, 1 is accepted

Sort by
0
AndyRutter
Top achievements
Rank 2
answered on 23 Mar 2009, 07:02 PM
OK I am making some progress with this but I don't know any Javascript and it's taking some time working out the methods and events.

I am trying to work out the best way to compare the current user with the user stored against the AppointmentData.

I can get the values of my additional attributes and therefore the UserName value.
However I can't work out how to get the value of the current user to compare it against.
Unsure if you can call VB codebehind functions from within the Javascript, I have tried this but can't get it to work.

Does any one have any ideas for this?

I have a public variable on the codebehind called CurrentUser, just need to get it's value into my javascript functions somehow...

Thanks in advance

Brian
0
AndyRutter
Top achievements
Rank 2
answered on 24 Mar 2009, 10:34 AM
OK it looks like I might have sorted this one.
An example of the javascript is:

function onAppointmentEditing(sender, eventArgs){  
var AppointmentOwner = eventArgs.get_appointment().get_attributes().getAttribute("MemberName");  
var CurrentUser = '<%= returnCurrentUser %>';  
              
if (AppointmentOwner != CurrentUser) {  
  alert("Editing appointments created by other members is not allowed.");  
  eventArgs.set_cancel(true);  
  }  

In case anyone else finds this useful..
0
Peter
Telerik team
answered on 24 Mar 2009, 03:57 PM

Hi Brian,

Thank you for posting your solution here. I have also suggested a server side solution in the support ticket about this issue:


Protected Sub RadScheduler1_AppointmentDataBound(sender As Object, e As SchedulerEventArgs)  
    If e.Appointment.Attributes("MemberName") = "Brian Turner" Then 
        e.Appointment.AllowEdit = False 
    End If 
    'e.Appointment.AllowDelete = false;  
End Sub 
 



Kind regards,
Peter
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Scheduler
Asked by
AndyRutter
Top achievements
Rank 2
Answers by
AndyRutter
Top achievements
Rank 2
Peter
Telerik team
Share this question
or