How to grant permission to user if login method used is custom

85 Views Asked by At

I am using a custom authentication method for storing and retrieving data in the realm object server.

I would like the user to grant permission to other users.

 String REALM_URL = "realm://" + OBJECT_SERVER_IP + ":" + OBJECT_SERVER_PORT + "/~/"

 if (!userId.equalsIgnoreCase("userId")) {
        UserCondition condition = UserCondition.keyValue("userId", "userId");
        AccessLevel accessLevel = AccessLevel.WRITE;
        PermissionRequest request = new PermissionRequest(condition, REALM_URL + companyId, accessLevel);

        pm.applyPermissions(request, new PermissionManager.ApplyPermissionsCallback() {
            @Override
            public void onSuccess() {
                Ln.d("Permission has been granted to sukumar");
            }

            @Override
            public void onError(ObjectServerError error) {
                Ln.d("Couldn't grant permission to sukumar" + error.getErrorMessage());
            }
        });

This is the error I am getting:

INVALID_PARAMETERS(601)
Your request parameters did not validate.

The custom auth takes in a userId and a companyId.

0

There are 0 best solutions below