Page MenuHomePhabricator

Support proper policies in Calendar
Closed, ResolvedPublic

Description

Calendar events implement PhabricatorPolicyInterface, but do it in a trivial way. Particularly, it isn't possible to create a private event.

Calendar should support standard view, edit, and join policies.

(We may eventually need to do something around letting other users see that you're busy in a block, but not see what you're busy with, but that can come later. For now, just implement standard policy support.)

Event Timeline

epriestley assigned this task to lpriestley.
epriestley raised the priority of this task from to Normal.
epriestley updated the task description. (Show Details)
epriestley added a project: Calendar.
epriestley added a subscriber: epriestley.
  • Add viewPolicy and editPolicy fields to the object.
  • Add these columns in .sql files.

Also issue these SQL statements to set the existing event policies to be consistent with their old behavior:

UPDATE {$NAMESPACE}_calendar.calendar_event
  SET viewPolicy = 'users' WHERE viewPolicy = '';

UPDATE {$NAMESPACE}_calendar.calendar_event
  SET editPolicy = userPHID;

That will make every existing event be visible to all users, and editable only by the creator.

  • Change the PhabricatorPolicyInterface-related methods to use these new properties.
  • The hasAutomaticCapability() method should give all invitees with a non-UNINVITED status an automatic view capability: you can always view an event you're invited to.
  • In CalendarEvent::initializeNewCalendarEvent(), we should set the viewPolicy and editPolicy to the creating user's PHID by default.
    • In the future, we might want to make it easier to quickly create public events via the API, but for now this will make the default be "events are private among the invitees".
  • Add view/edit policy controls to the edit page.