code: public final void checkPermission(@Nonnull Permission p) {
          Authentication a = Jenkins.getAuthentication();
          if (a == SYSTEM) {
              return;
          }
          if(!hasPermission(a,p))
              throw new AccessDeniedException2(a,p);
      }
docs: Checks if the current security principal has this permission.
  
  <p>
  This is just a convenience function.
  
  @throws AccessDeniedException
  if the user doesn't have the permission.