Search in sources :

Example 6 with Verify

use of app.hongs.action.anno.Verify in project HongsCORE by ihongs.

the class MineAction method mineUpdate.

@Action("update")
@Verify(conf = "master", form = "mine", type = 1, trim = 1)
public void mineUpdate(ActionHelper ah) throws HongsException {
    Map rd = ah.getRequestData();
    String id = (String) ah.getSessibute(Cnst.UID_SES);
    // 禁止危险修改
    rd.put("id", id);
    rd.remove("roles");
    rd.remove("rtime");
    rd.remove("mtime");
    rd.remove("ctime");
    rd.remove("state");
    // 验证原始密码
    String pw = (String) rd.get("password");
    String po = (String) rd.get("passolde");
    if (pw != null && !"".equals(pw)) {
        Map xd = new HashMap();
        Map ed = new HashMap();
        xd.put("errs", ed);
        xd.put("ok", false);
        xd.put("msg", CoreLocale.getInstance().translate("fore.form.invalid"));
        if (po != null && !"".equals(po)) {
            Map row = DB.getInstance("master").getTable("user").fetchCase().filter("id = ?", id).select("password").one();
            po = AuthKit.getCrypt(po);
            if (!po.equals(row.get("password"))) {
                ed.put("passolde", "旧密码不正确");
                ah.reply(xd);
                return;
            }
        } else {
            ed.put("passolde", "请填写旧密码");
            ah.reply(xd);
            return;
        }
    }
    UserAction ua = new UserAction();
    ua.doSave(ah);
}
Also used : UserAction(app.hongs.serv.master.UserAction) HashMap(java.util.HashMap) Map(java.util.Map) HashMap(java.util.HashMap) Action(app.hongs.action.anno.Action) UserAction(app.hongs.serv.master.UserAction) Verify(app.hongs.action.anno.Verify)

Example 7 with Verify

use of app.hongs.action.anno.Verify in project HongsCORE by ihongs.

the class SignAction method userCreate.

/**
 * 注册
 * @param ah
 * @throws app.hongs.HongsException
 */
@Action("user/create")
@Preset(conf = "master", form = "mine")
@Verify(conf = "master", form = "mine")
public void userCreate(ActionHelper ah) throws HongsException {
    Map rd = ah.getRequestData();
    User uo = (User) DB.getInstance("master").getModel("user");
    Map sd = uo.create(rd);
    // 提取登录信息
    String usrid = Synt.declare(sd.get("id"), "");
    String uname = Synt.declare(sd.get("name"), "");
    String uhead = Synt.declare(sd.get("head"), "");
    long utime = Synt.declare(sd.get("mtime"), 0L) * 1000;
    String appid = Synt.declare(ah.getParameter("appid"), "_WEB_");
    // 赋予公共权限
    sd = new HashMap();
    sd.put("user_id", usrid);
    sd.put("role", "public");
    uo.db.getTable("user_role").insert(sd);
    // 加入公共部门
    sd = new HashMap();
    sd.put("user_id", usrid);
    sd.put("dept_id", "PUBLIC");
    uo.db.getTable("user_dept").insert(sd);
    ah.reply(AuthKit.userSign(ah, null, appid, usrid, uname, uhead, utime));
}
Also used : User(app.hongs.serv.master.User) HashMap(java.util.HashMap) Map(java.util.Map) HashMap(java.util.HashMap) Action(app.hongs.action.anno.Action) Preset(app.hongs.action.anno.Preset) Verify(app.hongs.action.anno.Verify)

Example 8 with Verify

use of app.hongs.action.anno.Verify 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 data = helper.getRequestData();
    String id = model.set(data);
    Map info = new HashMap();
    info.put("id", id);
    info.put("name", data.get("name"));
    CoreLocale lang = CoreLocale.getInstance().clone();
    lang.load("matrix");
    String ms = lang.translate("core.save.unit.success");
    helper.reply(ms, info);
}
Also used : CoreLocale(app.hongs.CoreLocale) HashMap(java.util.HashMap) Map(java.util.Map) HashMap(java.util.HashMap) Action(app.hongs.action.anno.Action) CommitSuccess(app.hongs.action.anno.CommitSuccess) Verify(app.hongs.action.anno.Verify)

Example 9 with Verify

use of app.hongs.action.anno.Verify in project HongsCORE by ihongs.

the class JointGate method update.

@Override
@Action("update")
@Preset(conf = "", form = "", deft = { ":update" })
@Verify(conf = "", form = "")
@CommitSuccess
public void update(ActionHelper helper) throws HongsException {
    IEntity sr = getEntity(helper);
    Map rd = helper.getRequestData();
    rd = getReqMap(helper, sr, "update", rd);
    int sn = sr.update(rd);
    String ss = getRspMsg(helper, sr, "update", sn);
    helper.reply(ss, sn);
}
Also used : NaviMap(app.hongs.action.NaviMap) Map(java.util.Map) Action(app.hongs.action.anno.Action) CommitSuccess(app.hongs.action.anno.CommitSuccess) Preset(app.hongs.action.anno.Preset) Verify(app.hongs.action.anno.Verify)

Aggregations

Action (app.hongs.action.anno.Action)9 Verify (app.hongs.action.anno.Verify)9 Map (java.util.Map)9 CommitSuccess (app.hongs.action.anno.CommitSuccess)6 Preset (app.hongs.action.anno.Preset)5 HashMap (java.util.HashMap)4 NaviMap (app.hongs.action.NaviMap)3 CoreLocale (app.hongs.CoreLocale)2 Select (app.hongs.action.anno.Select)2 IAction (app.hongs.dh.IAction)2 DB (app.hongs.db.DB)1 Table (app.hongs.db.Table)1 FetchCase (app.hongs.db.util.FetchCase)1 RoleMap (app.hongs.serv.auth.RoleMap)1 RoleSet (app.hongs.serv.auth.RoleSet)1 User (app.hongs.serv.master.User)1 UserAction (app.hongs.serv.master.UserAction)1 Set (java.util.Set)1