Add attribute isReadOnly to event/task JSON view
parent
5e3b3e6987
commit
550fc09ee4
|
@ -548,6 +548,7 @@
|
|||
* @apiSuccess (Success 200) {String} endDate End date (ISO8601)
|
||||
* @apiSuccess (Success 200) {String} localizedEndDate Formatted end date
|
||||
* @apiSuccess (Success 200) {String} [localizedEndTime] Formatted end time
|
||||
* @apiSuccess (Success 200) {Number} isReadOnly 1 if event is read-only
|
||||
*
|
||||
* From [iCalEvent+SOGo attributes]
|
||||
*
|
||||
|
@ -669,6 +670,7 @@
|
|||
[co nameInContainer], @"id",
|
||||
[componentCalendar nameInContainer], @"pid",
|
||||
[componentCalendar displayName], @"calendar",
|
||||
[NSNumber numberWithBool: [self isReadOnly]], @"isReadOnly",
|
||||
[dateFormatter formattedDate: eventStartDate], @"localizedStartDate",
|
||||
[dateFormatter formattedDate: eventEndDate], @"localizedEndDate",
|
||||
nil];
|
||||
|
|
|
@ -29,10 +29,12 @@
|
|||
|
||||
@interface UIxComponentEditor : UIxComponent
|
||||
{
|
||||
id item;
|
||||
iCalRepeatableEntityObject *component;
|
||||
SOGoAppointmentFolder *componentCalendar;
|
||||
}
|
||||
|
||||
- (BOOL) isReadOnly;
|
||||
- (void) setAttributes: (NSDictionary *) attributes;
|
||||
|
||||
+ (NSArray *) reminderValues;
|
||||
|
|
|
@ -714,93 +714,92 @@ static NSArray *reminderValues = nil;
|
|||
//
|
||||
// return toolbarFilename;
|
||||
//}
|
||||
//
|
||||
//
|
||||
//- (int) ownerIsAttendee: (SOGoUser *) ownerUser
|
||||
// andClientObject: (SOGoContentObject
|
||||
// <SOGoComponentOccurence> *) clientObject
|
||||
//{
|
||||
// BOOL isOrganizer;
|
||||
// iCalPerson *ownerAttendee;
|
||||
// int rc;
|
||||
//
|
||||
// rc = 0;
|
||||
//
|
||||
// isOrganizer = [component userIsOrganizer: ownerUser];
|
||||
// if (isOrganizer)
|
||||
// isOrganizer = ![ownerUser hasEmail: [[component organizer] sentBy]];
|
||||
//
|
||||
// if (!isOrganizer && ![[component tag] isEqualToString: @"VTODO"])
|
||||
// {
|
||||
// ownerAttendee = [component userAsAttendee: ownerUser];
|
||||
// if (ownerAttendee)
|
||||
// rc = 1;
|
||||
// }
|
||||
//
|
||||
// return rc;
|
||||
//}
|
||||
//
|
||||
//- (int) delegateIsAttendee: (SOGoUser *) ownerUser
|
||||
// andClientObject: (SOGoContentObject
|
||||
// <SOGoComponentOccurence> *) clientObject
|
||||
//{
|
||||
// SoSecurityManager *sm;
|
||||
// iCalPerson *ownerAttendee;
|
||||
// int rc;
|
||||
//
|
||||
// rc = 0;
|
||||
//
|
||||
// sm = [SoSecurityManager sharedSecurityManager];
|
||||
// if (![sm validatePermission: SOGoCalendarPerm_ModifyComponent
|
||||
// onObject: clientObject
|
||||
// inContext: context])
|
||||
// rc = [self ownerIsAttendee: ownerUser
|
||||
// andClientObject: clientObject];
|
||||
// else if (![sm validatePermission: SOGoCalendarPerm_RespondToComponent
|
||||
// onObject: clientObject
|
||||
// inContext: context])
|
||||
// {
|
||||
// ownerAttendee = [component userAsAttendee: ownerUser];
|
||||
// if ([[ownerAttendee rsvp] isEqualToString: @"true"]
|
||||
// && ![component userIsOrganizer: ownerUser])
|
||||
// rc = 1;
|
||||
// else
|
||||
// rc = 2;
|
||||
// }
|
||||
// else
|
||||
// rc = 2; // not invited, just RO
|
||||
//
|
||||
// return rc;
|
||||
//}
|
||||
//
|
||||
//- (int) getEventRWType
|
||||
//{
|
||||
// SOGoContentObject <SOGoComponentOccurence> *clientObject;
|
||||
// SOGoUser *ownerUser;
|
||||
// int rc;
|
||||
//
|
||||
// clientObject = [self clientObject];
|
||||
// ownerUser
|
||||
// = [SOGoUser userWithLogin: [clientObject ownerInContext: context]];
|
||||
// if ([componentCalendar isKindOfClass: [SOGoWebAppointmentFolder class]])
|
||||
// rc = 2;
|
||||
// else
|
||||
// {
|
||||
// if ([ownerUser isEqual: [context activeUser]])
|
||||
// rc = [self ownerIsAttendee: ownerUser
|
||||
// andClientObject: clientObject];
|
||||
// else
|
||||
// rc = [self delegateIsAttendee: ownerUser
|
||||
// andClientObject: clientObject];
|
||||
// }
|
||||
//
|
||||
// return rc;
|
||||
//}
|
||||
//
|
||||
//- (BOOL) eventIsReadOnly
|
||||
//{
|
||||
// return [self getEventRWType] != 0;
|
||||
//}
|
||||
|
||||
|
||||
- (int) ownerIsAttendee: (SOGoUser *) ownerUser
|
||||
andClientObject: (SOGoContentObject
|
||||
<SOGoComponentOccurence> *) clientObject
|
||||
{
|
||||
BOOL isOrganizer;
|
||||
iCalPerson *ownerAttendee;
|
||||
int rc;
|
||||
|
||||
rc = 0;
|
||||
|
||||
isOrganizer = [component userIsOrganizer: ownerUser];
|
||||
if (isOrganizer)
|
||||
isOrganizer = ![ownerUser hasEmail: [[component organizer] sentBy]];
|
||||
|
||||
if (!isOrganizer && ![[component tag] isEqualToString: @"VTODO"])
|
||||
{
|
||||
ownerAttendee = [component userAsAttendee: ownerUser];
|
||||
if (ownerAttendee)
|
||||
rc = 1;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (int) delegateIsAttendee: (SOGoUser *) ownerUser
|
||||
andClientObject: (SOGoContentObject
|
||||
<SOGoComponentOccurence> *) clientObject
|
||||
{
|
||||
SoSecurityManager *sm;
|
||||
iCalPerson *ownerAttendee;
|
||||
int rc;
|
||||
|
||||
rc = 0;
|
||||
|
||||
sm = [SoSecurityManager sharedSecurityManager];
|
||||
if (![sm validatePermission: SOGoCalendarPerm_ModifyComponent
|
||||
onObject: clientObject
|
||||
inContext: context])
|
||||
rc = [self ownerIsAttendee: ownerUser
|
||||
andClientObject: clientObject];
|
||||
else if (![sm validatePermission: SOGoCalendarPerm_RespondToComponent
|
||||
onObject: clientObject
|
||||
inContext: context])
|
||||
{
|
||||
ownerAttendee = [component userAsAttendee: ownerUser];
|
||||
if ([[ownerAttendee rsvp] isEqualToString: @"true"]
|
||||
&& ![component userIsOrganizer: ownerUser])
|
||||
rc = 1;
|
||||
else
|
||||
rc = 2;
|
||||
}
|
||||
else
|
||||
rc = 2; // not invited, just RO
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (int) getEventRWType
|
||||
{
|
||||
SOGoContentObject <SOGoComponentOccurence> *clientObject;
|
||||
SOGoUser *ownerUser;
|
||||
int rc;
|
||||
|
||||
clientObject = [self clientObject];
|
||||
ownerUser = [SOGoUser userWithLogin: [clientObject ownerInContext: context]];
|
||||
if ([componentCalendar isKindOfClass: [SOGoWebAppointmentFolder class]])
|
||||
rc = 2;
|
||||
else
|
||||
{
|
||||
if ([ownerUser isEqual: [context activeUser]])
|
||||
rc = [self ownerIsAttendee: ownerUser
|
||||
andClientObject: clientObject];
|
||||
else
|
||||
rc = [self delegateIsAttendee: ownerUser
|
||||
andClientObject: clientObject];
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (BOOL) isReadOnly
|
||||
{
|
||||
return [self getEventRWType] != 0;
|
||||
}
|
||||
//
|
||||
//- (NSString *) emailAlarmsEnabled
|
||||
//{
|
||||
|
|
|
@ -402,6 +402,7 @@
|
|||
* @apiSuccess (Success 200) {String} completedTime Formatted completed time
|
||||
* @apiSuccess (Success 200) {String} status Status (needs-action, in-process, completed, or cancelled)
|
||||
* @apiSuccess (Success 200) {Number} percentComplete Percent completion
|
||||
* @apiSuccess (Success 200) {Number} isReadOnly 1 if task is read-only
|
||||
*
|
||||
* From [iCalEntityObject+SOGo attributes]
|
||||
*
|
||||
|
@ -519,6 +520,7 @@
|
|||
[co nameInContainer], @"id",
|
||||
[thisFolder nameInContainer], @"pid",
|
||||
[thisFolder displayName], @"calendar",
|
||||
[NSNumber numberWithBool: [self isReadOnly]], @"isReadOnly",
|
||||
nil];
|
||||
|
||||
if (startDate)
|
||||
|
|
Loading…
Reference in New Issue