Added a new function: check_perms().