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

Scheduler Security

3 Answers 83 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Timothy Kruszewski
Top achievements
Rank 1
Timothy Kruszewski asked on 10 Jan 2011, 08:35 PM
I have a scenario where certian users of an administrator group need to be able to view all appointments for any users in my scheduler(see screen shot 1) which works just fine.  Now I need to limit what users are displayed on the add/edit addointment screen based on my security model(see screen shot 2).  Is this possible?  Currently my OnDataBound Event only displays users on the add/Edit for that have been selected from the checkbox list.



protected void RadScheduler1_OnDataBound(object sender, EventArgs e)
   {
         
       foreach (Resource res in RadScheduler1.Resources.GetResourcesByType("User Name"))
       {
           RadScheduler1.Resources.Remove(res);
       }
       List<Resource> list = new List<Resource>();
       foreach (Telerik.Web.UI.Appointment a in RadScheduler1.Appointments.GetAppointmentsInRange(RadScheduler1.VisibleRangeStart, RadScheduler1.VisibleRangeEnd))
       {
           Resource userName = a.Resources.GetResourceByType("User Name");
           if (userName != null && !list.Contains(userName))
           {
               list.Add(userName);
           }
           foreach (ListItem l in cblUsers.Items)
           {
               if (l.Selected)
               {
                   Resource name = new Resource("User Name", int.Parse(l.Value), l.Text);
                   if (!list.Contains(name))
                   {
                       list.Add(name);
                   }
               }
           }
           //using (ProNetData d = new ProNetData())
           //{
           //    var users = (from c in d.AppointmentUsersAssigned.Include("User")
           //                 select new { UserID = c.UserID, UserName = c.User.LastName + ", " + c.User.FirstName.Substring(0, 1) }).ToList();
           //    foreach (var v in users)
           //    {
           //        Resource name = new Resource("User Name", v.UserID, v.UserName);
           //        if (!list.Contains(name))
           //        {
           //            list.Add(name);
           //        }
           //    }
           //}
       }
       list.Sort(delegate(Resource resA, Resource resB)
       {
           return resA.Text.CompareTo(resB.Text);
       });
       RadScheduler1.Resources.AddRange(list);
       RadScheduler1.ResourceTypes.FindByName("User Name").AllowMultipleValues = true;
   }

3 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 14 Jan 2011, 12:36 PM
Hi Timothy Kruszewski,

Please accept my apologies for the late reply.

Take a look at our demo about "Resource Availability" and let me know if you have further questions.

All the best,
Veronica Milcheva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Timothy Kruszewski
Top achievements
Rank 1
answered on 14 Jan 2011, 07:55 PM
That demo doesn't help me out at all.  It's very disappointinb that I had to wait 3 days to get a link I alrady knw about that does me no good.  If you look at ScreenShot1 you will see a list of users, from there I need to be able to add or remove those users from the add appointment form when someone tries to create a new appointment.
0
Veronica
Telerik team
answered on 19 Jan 2011, 02:52 PM
Hello Timothy Kruszewski,

You can subscribe to the OnFormCreated event and hide the checkboxes according to your security model. Please take a look at this KB article for an example.

If you still need assistance - please send me the full code so I can inspect it and help you.

Thank you!

Regards,
Veronica Milcheva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Scheduler
Asked by
Timothy Kruszewski
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Timothy Kruszewski
Top achievements
Rank 1
Share this question
or