core, restapi: Fix add permissions

The refactoring of the authentication mechanism introduced two different
identifiers for users and groups: one used internally by the engine and
one used by the external directory. The RESTAPI wasn't correctly
handling requests to add permissions when the provided identifier was
the internal one. The patch fixes the RESTAPI and the backend so that
they will accept both identifiers when adding users or groups.

Change-Id: I0d05c4bf4ebd242fd3a01a2f9a8d679f687c4982
Bug-Url: https://bugzilla.redhat.com/1064829
Signed-off-by: Juan Hernandez <juan.hernandez@redhat.com>
(cherry picked from commit 072cc1f4c3495b75f344688c9b28691875a12f88)