XamScheduleDataManager exposes properties that let you control whether the user is allowed to perform certain operations. These properties are exposed by the XamScheduleDataManager via its Settings property, which is of the type ScheduleSettings class. The following is a list of properties that the ScheduleSettings class exposes related to user permissions.
-
AllowCalendarClosing – Determines whether the user is allowed to close calendars via the UI. This property can affect the visibility of the close button on the calendar tabs. Setting the property to False will hide the buttons if the view control’s ShowCalendarCloseButton is set to its default value of null.
-
AppointmentSettings – Contains settings for appointments
-
JournalSettings – Contains settings for journals
-
TaskSettings – Contains settings for tasks
AppointmentSettings, JournalSettings and TaskSettings all expose the following properties:
-
AllowAdd – Specifies whether the user is allowed to add an activity – appointment, journal or task – depending on whether the property belongs to AppointmentSettings, JournalSettings or TaskSettings respectively.
-
AllowEdit – Specifies whether the user is allowed to modify an existing activity.
-
AllowDragging – Specifies whether the user is allowed to drag activities. Dragging offers a convenient way for the user to update the activity’s time or make a copy of an activity by holding down the Ctrl key when the activity is dropped.
-
AllowRecurring – Specifies whether the user is allowed to create recurring activities.
-
AllowRemove – Specifies whether the user is allowed to remove activities.
-
AllowResizing – Specifies whether the user is allowed to resize activities. Resizing an activity offers a convenient way for the user to change the start or the end time of the activity.
-
AllowTimeZoneNeutral – Specifies whether the user can create time-zone neutral activities. Time-zone neutral activities are activities that do not have a specific time zone associated with them and do not start at a specific UTC time. Instead they have a floating start time that starts at the same ‘local’ time in different time zones. Note that if AllowTimeZoneNeutral is set to ‘false’ on AppointmentSettings then the ‘All Day Event’ checkbox will not be displayed on the appointment dialog.
In addition to the above properties, Resource and ActivityBase objects expose the following properties that affect user permissions.
-
Resource. IsLocked – When set to True, prevents the user from modifying – including adding and removing – activities of this resource.
-
ActivityBase. IsLocked – When set to True, prevents the user from modifying or removing the activity.
If you want to conditionally make a determination, for example based on the context of the activity, whether the user should be allowed to perform an operation, then one option is to hook into the event on the XamScheduleDataManager associated with the operation. For example, to prevent the user from adding, removing or committing changes to activities of other resources, you can cancel the ActivityAdding, ActivityRemoving or ActivityChanging event respectively by checking the activity of the event args.
<ig:XamScheduleDataManager
Name="DataManager"
CurrentUserId="own1"
DataConnector="{Binding ElementName=connector}">
<ig:XamScheduleDataManager.Settings>
<ig:ScheduleSettings AllowCalendarClosing=">
<ig:ScheduleSettings.AppointmentSettings>
<ig:AppointmentSettings
AllowDragging="WithinCalendar"
AllowRecurring="
AllowResizing="StartAndEnd"
AllowTimeZoneNeutral=" />
</ig:ScheduleSettings.AppointmentSettings>
<ig:ScheduleSettings.JournalSettings>
<ig:JournalSettings
AllowAdd="
AllowRemove="
AllowEdit=" />
</ig:ScheduleSettings.JournalSettings>
<ig:ScheduleSettings.TaskSettings>
<ig:TaskSettings
AllowRemove="
AllowTimeZoneNeutral="
AllowRecurring=" />
</ig:ScheduleSettings.TaskSettings>
</ig:ScheduleSettings>
</ig:XamScheduleDataManager.Settings>
</ig:XamScheduleDataManager>
Dim settings As New ScheduleSettings()
settings.AllowCalendarClosing = False
' Create a new AppointmentSettings object.
Dim appointmentSettings As New AppointmentSettings()
appointmentSettings.AllowDragging =_
AllowActivityDragging.WithinCalendar
appointmentSettings.AllowRecurring = False
appointmentSettings.AllowResizing =_
AllowActivityResizing.StartAndEnd
appointmentSettings.AllowTimeZoneNeutral = False
' Set the AppointmentSettings property of the ScheduleSettings.
settings.AppointmentSettings = appointmentSettings
' Create a new JournalSettings object.
Dim journalSettings As New JournalSettings()
journalSettings.AllowAdd = False
journalSettings.AllowRemove = False
journalSettings.AllowEdit = False
' Set the JournalSettings property of the ScheduleSettings.
settings.JournalSettings = journalSettings
' Create a new JournalSettings object.
Dim taskSettings As New TaskSettings()
taskSettings.AllowRemove = False
taskSettings.AllowTimeZoneNeutral = False
taskSettings.AllowRecurring = False
' Set the TaskSettings property of the ScheduleSettings.
settings.TaskSettings = taskSettings
' Set the Settings property to the ScheduleSettings object.
_dataManager.Settings = settings
ScheduleSettings settings = new ScheduleSettings();
settings.AllowCalendarClosing = false;
// Create a new AppointmentSettings object.
AppointmentSettings appointmentSettings =
new AppointmentSettings();
appointmentSettings.AllowDragging =
AllowActivityDragging.WithinCalendar;
appointmentSettings.AllowRecurring = false;
appointmentSettings.AllowResizing =
AllowActivityResizing.StartAndEnd;
appointmentSettings.AllowTimeZoneNeutral = false;
// Set the AppointmentSettings property of the ScheduleSettings.
settings.AppointmentSettings = appointmentSettings;
// Create a new JournalSettings object.
JournalSettings journalSettings = new JournalSettings();
journalSettings.AllowAdd = false;
journalSettings.AllowRemove = false;
journalSettings.AllowEdit = false;
// Set the JournalSettings property of the ScheduleSettings.
settings.JournalSettings = journalSettings;
// Create a new JournalSettings object.
TaskSettings taskSettings = new TaskSettings();
taskSettings.AllowRemove = false;
taskSettings.AllowTimeZoneNeutral = false;
taskSettings.AllowRecurring = false;
// Set the TaskSettings property of the ScheduleSettings.
settings.TaskSettings = taskSettings;
// Set the Settings property to the ScheduleSettings object.
_dataManager.Settings = settings;