Adding CheckPrivilege custom function