entityPermission function