Added more controller functions for privileges.

Added extractPrivilegeFromDict(dict) and privilegeToJSON(privilege) and
associated tests.