added the setPermission function