<commit_before>package lila.security

import lila.user.{ User, UserRepo }

private[security] final class Cli extends lila.common.Cli {

  def process = {

    case "security" :: "enable" :: uid :: Nil =>
      perform(uid, u => UserRepo enable u.id)

    case "security" :: "disable" :: uid :: Nil =>
      perform(uid, u => (UserRepo disable u.id) >> (Store disconnect u.id))

    case "security" :: "passwd" :: uid :: pwd :: Nil =>
      perform(uid, user => UserRepo.passwd(user.id, pwd))

    case "security" :: "roles" :: uid :: Nil =>
      UserRepo named uid map {
        _.fold("User %s not found" format uid)(_.roles mkString " ")
      }

    case "security" :: "grant" :: uid :: roles =>
      perform(uid, user =>
        UserRepo.setRoles(user.id, roles map (_.toUpperCase))
      )
  }

  private def perform(username: String, op: User => Funit): Fu[String] =
    UserRepo named username flatMap { userOption =>
      userOption.fold(fufail[String]("User %s not found" format username)) { u =>
        op(u) inject "User %s successfully updated".format(username)
      }
    }
}
<commit_msg>remove cli commands that are available through web UI<commit_after>package lila.security

import lila.user.{ User, UserRepo }

private[security] final class Cli extends lila.common.Cli {

  def process = {

    case "security" :: "passwd" :: uid :: pwd :: Nil =>
      perform(uid, user => UserRepo.passwd(user.id, pwd))

    case "security" :: "roles" :: uid :: Nil =>
      UserRepo named uid map {
        _.fold("User %s not found" format uid)(_.roles mkString " ")
      }

    case "security" :: "grant" :: uid :: roles =>
      perform(uid, user =>
        UserRepo.setRoles(user.id, roles map (_.toUpperCase))
      )
  }

  private def perform(username: String, op: User => Funit): Fu[String] =
    UserRepo named username flatMap { userOption =>
      userOption.fold(fufail[String]("User %s not found" format username)) { u =>
        op(u) inject "User %s successfully updated".format(username)
      }
    }
}

{'fraction_non_alphanumeric': 0.1483489403647117, 'fraction_numerical': 0.0, 'mean_word_length': 2.934108527131783, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5983237', 'n_tokens_mistral': 654, 'n_tokens_neox': 640, 'n_words': 185}