/**
   * Get the permission level by the given level number.
   *
   * @param level Level number.
   * @return Permission level.
   */
  public static PermissionLevel getByLevel(int level) {
    // Loop through all the permission levels to find the proper one
    for (PermissionLevel permissionLevel : values())
      if (permissionLevel.getLevel() == level) return permissionLevel;

    // Return the base level
    return VIEW_ANONYMOUS;
  }
 /**
  * Check whether the given permission is equal or worse than the current permission.
  *
  * @param test Permission to test.
  * @return True if worse, false if not.
  */
 public boolean orWorse(PermissionLevel test) {
   return test.getLevel() >= getLevel();
 }
 /**
  * Check whether the given permission is equal or better than the current permission.
  *
  * @param test Permission to test.
  * @return True if better, false if not.
  */
 public boolean orBetter(PermissionLevel test) {
   return test.getLevel() <= getLevel();
 }