<commit_before>package com.ecfront.ez.framework.module.auth

import com.ecfront.ez.framework.module.auth.manage.{AccountService, ResourceService, RoleService}
import com.ecfront.ez.framework.service.IdModel

object AuthBasic {

  val ADD_SOME = s"POST${IdModel.SPLIT_FLAG}/some/"
  val GET_SOME = s"GET${IdModel.SPLIT_FLAG}/some/:id/"

  def init(): Unit = {
    val res = Resource()
    res.id = GET_SOME
    res.name = "获取资源"
    ResourceService._save(res)
    res.id = ADD_SOME
    res.name = "保存资源"
    ResourceService._save(res)

    val role1 = Role()
    role1.id = "admin"
    role1.name = "管理员"
    RoleService._save(role1)
    role1.resource_ids = Map(GET_SOME -> null, ADD_SOME -> null)
    RoleService._update("admin", role1)


    val role2 = Role()
    role2.id = "user"
    role2.name = "普通用户"
    role2.resource_ids = Map(GET_SOME -> null, ADD_SOME -> null)
    RoleService._save(role2)
    role2.resource_ids = Map()
    RoleService._update("user", role2)

    val account1 = Account()
    account1.id = "user1"
    account1.name = "用户1"
    account1.password = "<PASSWORD>"
    account1.email = "<EMAIL>"
    account1.role_ids = Map("admin" -> null)
    AccountService._save(account1)

    val account2 = Account()
    account2.id = "user2"
    account2.name = "用户2"
    account2.password = "<PASSWORD>"
    account2.email = "<EMAIL>"
    account2.role_ids = Map("admin" -> null, "user" -> null)
    AccountService._save(account2)
    val newAccount2 = AccountService._getById("user2").body
    assert(newAccount2.role_ids == Map("admin" -> "管理员", "user" -> "普通用户"))
    newAccount2.role_ids = Map()
    newAccount2.password = "<PASSWORD>"
    AccountService._update("user2", newAccount2)
  }

}




<commit_msg>initialization<commit_after>package com.ecfront.ez.framework.module.auth

import com.ecfront.ez.framework.module.auth.manage.{AccountService, ResourceService, RoleService}
import com.ecfront.ez.framework.service.IdModel

object AuthBasic {

  val ADD_SOME = s"POST${IdModel.SPLIT_FLAG}/some/"
  val GET_SOME = s"GET${IdModel.SPLIT_FLAG}/some/:id/"

  def init(): Unit = {
    val res = Resource()
    res.id = GET_SOME
    res.name = "获取资源"
    ResourceService._save(res)
    res.id = ADD_SOME
    res.name = "保存资源"
    ResourceService._save(res)

    val role1 = Role()
    role1.id = "admin"
    role1.name = "管理员"
    RoleService._save(role1)
    role1.resource_ids = Map(GET_SOME -> null, ADD_SOME -> null)
    RoleService._update("admin", role1)

    val role2 = Role()
    role2.id = "user"
    role2.name = "普通用户"
    role2.resource_ids = Map(GET_SOME -> null, ADD_SOME -> null)
    RoleService._save(role2)
    role2.resource_ids = Map()
    RoleService._update("user", role2)

    val account1 = Account()
    account1.id = "user1"
    account1.name = "用户1"
    account1.password = "<PASSWORD>"
    account1.email = "<EMAIL>"
    account1.role_ids = Map("admin" -> null)
    AccountService._save(account1)

    val account2 = Account()
    account2.id = "user2"
    account2.name = "用户2"
    account2.password = "<PASSWORD>"
    account2.email = "<EMAIL>"
    account2.role_ids = Map("admin" -> null, "user" -> null)
    AccountService._save(account2)
    val newAccount2 = AccountService._getById("user2").body
    assert(newAccount2.role_ids == Map("admin" -> "管理员", "user" -> "普通用户"))
    newAccount2.role_ids = Map()
    newAccount2.password = "<PASSWORD>"
    AccountService._update("user2", newAccount2)
  }

}





{'fraction_non_alphanumeric': 0.14508670520231215, 'fraction_numerical': 0.021965317919075144, 'mean_word_length': 3.304726368159204, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 31, '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': '7590464', 'n_tokens_mistral': 1261, 'n_tokens_neox': 1260, 'n_words': 220}