Search in sources :

Example 1 with User

use of io.github.ihongs.serv.master.User in project HongsCORE by ihongs.

the class SignAction method userCreate.

/**
 * 注册
 * @param ah
 * @throws HongsException
 */
@Action("user/create")
@Verify(conf = "master", form = "regs", type = 0, trim = 1)
@CommitSuccess
public void userCreate(ActionHelper ah) throws HongsException {
    CoreConfig cc = CoreConfig.getInstance("master");
    if (!cc.getProperty("core.public.regs.open", true)) {
        throw new HongsException(404, "Sign on is not allowed");
    }
    User uo = (User) DB.getInstance("master").getModel("user");
    Map rd = ah.getRequestData();
    String uuid = uo.create(rd);
    String uname = Synt.declare(rd.get("name"), "");
    String uhead = Synt.declare(rd.get("head"), "");
    // 加入公共部门
    Map sd = new HashMap();
    sd.put("user_id", uuid);
    sd.put("dept_id", cc.getProperty("core.public.regs.dept", "CENTRE"));
    uo.db.getTable("dept_user").insert(sd);
    // 赋予公共权限. 仅用部门即可(2019/02/28)
    // Map  sd = new HashMap();
    // sd.put("user_id", uuid);
    // sd.put("role"   , cc.getProperty("core.public.regs.role", "centre"));
    // uo.db.getTable("user_role").insert(sd);
    // * 表示密码登录
    Map ad = AuthKit.userSign(ah, "*", uuid, uname, uhead);
    ah.reply(Synt.mapOf("info", ad));
}
Also used : User(io.github.ihongs.serv.master.User) CoreConfig(io.github.ihongs.CoreConfig) HongsException(io.github.ihongs.HongsException) HashMap(java.util.HashMap) Map(java.util.Map) HashMap(java.util.HashMap) Action(io.github.ihongs.action.anno.Action) CommitSuccess(io.github.ihongs.action.anno.CommitSuccess) Verify(io.github.ihongs.action.anno.Verify)

Example 2 with User

use of io.github.ihongs.serv.master.User in project HongsCORE by ihongs.

the class SignAction method userUnique.

/**
 * 查重
 * @param ah
 * @throws HongsException
 */
@Action("user/unique")
public void userUnique(ActionHelper ah) throws HongsException {
    User uo = (User) DB.getInstance("master").getModel("user");
    Map rd = ah.getRequestData();
    boolean v = uo.unique(rd);
    ah.reply(null, v ? 1 : 0);
}
Also used : User(io.github.ihongs.serv.master.User) Map(java.util.Map) HashMap(java.util.HashMap) Action(io.github.ihongs.action.anno.Action)

Aggregations

Action (io.github.ihongs.action.anno.Action)2 User (io.github.ihongs.serv.master.User)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 CoreConfig (io.github.ihongs.CoreConfig)1 HongsException (io.github.ihongs.HongsException)1 CommitSuccess (io.github.ihongs.action.anno.CommitSuccess)1 Verify (io.github.ihongs.action.anno.Verify)1