Search in sources :

Example 16 with CommitSuccess

use of io.github.ihongs.action.anno.CommitSuccess 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 17 with CommitSuccess

use of io.github.ihongs.action.anno.CommitSuccess in project HongsCORE by ihongs.

the class DeptAction method doDelete.

@Action("delete")
@CommitSuccess
public void doDelete(ActionHelper helper) throws HongsException {
    Map rd = helper.getRequestData();
    int rn = model.delete(rd);
    CoreLocale ln = CoreLocale.getInstance().clone();
    ln.load("master");
    String ms = ln.translate("core.delete.dept.success", null, Integer.toString(rn));
    helper.reply(ms, rn);
}
Also used : CoreLocale(io.github.ihongs.CoreLocale) HashMap(java.util.HashMap) NaviMap(io.github.ihongs.action.NaviMap) Map(java.util.Map) Action(io.github.ihongs.action.anno.Action) CommitSuccess(io.github.ihongs.action.anno.CommitSuccess)

Example 18 with CommitSuccess

use of io.github.ihongs.action.anno.CommitSuccess in project HongsCORE by ihongs.

the class FormAction method doDelete.

@Action("delete")
@CommitSuccess
public void doDelete(ActionHelper helper) throws HongsException {
    Map rd = helper.getRequestData();
    int rn = model.delete(rd);
    CoreLocale ln = CoreLocale.getInstance().clone();
    ln.load("matrix");
    String ms = ln.translate("core.delete.form.success", null, Integer.toString(rn));
    helper.reply(ms, rn);
}
Also used : CoreLocale(io.github.ihongs.CoreLocale) Map(java.util.Map) Action(io.github.ihongs.action.anno.Action) CommitSuccess(io.github.ihongs.action.anno.CommitSuccess)

Example 19 with CommitSuccess

use of io.github.ihongs.action.anno.CommitSuccess in project HongsCORE by ihongs.

the class UnitAction method doDelete.

@Action("delete")
@CommitSuccess
public void doDelete(ActionHelper helper) throws HongsException {
    Map rd = helper.getRequestData();
    int rn = model.delete(rd);
    CoreLocale ln = CoreLocale.getInstance().clone();
    ln.load("matrix");
    String ms = ln.translate("core.delete.unit.success", null, Integer.toString(rn));
    helper.reply(ms, rn);
}
Also used : CoreLocale(io.github.ihongs.CoreLocale) Map(java.util.Map) Action(io.github.ihongs.action.anno.Action) CommitSuccess(io.github.ihongs.action.anno.CommitSuccess)

Example 20 with CommitSuccess

use of io.github.ihongs.action.anno.CommitSuccess in project HongsCORE by ihongs.

the class UnitAction method doSave.

@Action("save")
@Verify(conf = "matrix", form = "unit")
@CommitSuccess
public void doSave(ActionHelper helper) throws HongsException {
    Map rd = helper.getRequestData();
    String id = model.set(rd);
    CoreLocale lang = CoreLocale.getInstance().clone();
    lang.load("matrix");
    String ms = lang.translate("core.save.unit.success");
    helper.reply(ms, id);
}
Also used : CoreLocale(io.github.ihongs.CoreLocale) Map(java.util.Map) Action(io.github.ihongs.action.anno.Action) CommitSuccess(io.github.ihongs.action.anno.CommitSuccess) Verify(io.github.ihongs.action.anno.Verify)

Aggregations

Action (io.github.ihongs.action.anno.Action)22 CommitSuccess (io.github.ihongs.action.anno.CommitSuccess)22 Map (java.util.Map)21 Verify (io.github.ihongs.action.anno.Verify)10 HashMap (java.util.HashMap)10 CoreConfig (io.github.ihongs.CoreConfig)7 CoreLocale (io.github.ihongs.CoreLocale)7 HongsException (io.github.ihongs.HongsException)7 Preset (io.github.ihongs.action.anno.Preset)7 NaviMap (io.github.ihongs.action.NaviMap)4 IAction (io.github.ihongs.dh.IAction)3 Table (io.github.ihongs.db.Table)2 Calendar (java.util.Calendar)2 Set (java.util.Set)2 DB (io.github.ihongs.db.DB)1 FetchCase (io.github.ihongs.db.util.FetchCase)1 SearchAction (io.github.ihongs.dh.search.SearchAction)1 RoleSet (io.github.ihongs.serv.auth.RoleSet)1 User (io.github.ihongs.serv.master.User)1 UserAction (io.github.ihongs.serv.master.UserAction)1