Search in sources :

Example 36 with Action

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

the class MineAction method signInfo.

@Action("sign/info")
public void signInfo(ActionHelper ah) {
    Map sd = new HashMap();
    String sk = CoreConfig.getInstance().getProperty("core.api.ssid");
    sd.put(sk, ah.getRequest().getRequestedSessionId());
    sd.put(Cnst.UID_SES, ah.getSessibute(Cnst.UID_SES));
    sd.put(Cnst.STM_SES, ah.getSessibute(Cnst.STM_SES));
    sd.put(Cnst.SAE_SES, ah.getSessibute(Cnst.SAE_SES));
    sd.put("appid", ah.getSessibute("appid"));
    sd.put("uname", ah.getSessibute("uname"));
    sd.put("uhead", ah.getSessibute("uhead"));
    ah.reply("", sd);
}
Also used : HashMap(java.util.HashMap) Map(java.util.Map) HashMap(java.util.HashMap) Action(app.hongs.action.anno.Action)

Example 37 with Action

use of app.hongs.action.anno.Action 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 38 with Action

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

the class SignAction method userDelete.

/**
 * 注销
 * @param ah
 */
@Action("user/delete")
public void userDelete(ActionHelper ah) throws HongsException {
    String uuid = (String) ah.getSessibute(Cnst.UID_SES);
    if (null == uuid) {
        ah.reply(AuthKit.getWrong(null, "core.sign.off.invalid"));
        return;
    }
    User user = (User) DB.getInstance("master").getModel("user");
    user.del(uuid);
    signDelete(ah);
}
Also used : User(app.hongs.serv.master.User) Action(app.hongs.action.anno.Action)

Example 39 with Action

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

the class DeptAction method isUnique.

@Action("unique")
public void isUnique(ActionHelper helper) throws HongsException {
    Map rd = helper.getRequestData();
    FetchCase fc = model.fetchCase();
    fc.setOption("INCLUDE_REMOVED", Synt.declare(rd.get("include-removed"), false));
    boolean rv = model.unique(rd, fc);
    helper.reply(null, rv ? 1 : 0);
}
Also used : FetchCase(app.hongs.db.util.FetchCase) HashMap(java.util.HashMap) NaviMap(app.hongs.action.NaviMap) Map(java.util.Map) RoleMap(app.hongs.serv.auth.RoleMap) Action(app.hongs.action.anno.Action)

Example 40 with Action

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

the class DeptAction method doSave.

@Action("save")
@CommitSuccess
public void doSave(ActionHelper helper) throws HongsException {
    Map rd = helper.getRequestData();
    String id = model.set(rd);
    rd = new HashMap();
    rd.put("id", id);
    rd.put("name", rd.get("name"));
    CoreLocale ln = CoreLocale.getInstance().clone();
    ln.load("master");
    String ms = ln.translate("core.save.dept.success");
    helper.reply(ms, rd);
}
Also used : CoreLocale(app.hongs.CoreLocale) HashMap(java.util.HashMap) HashMap(java.util.HashMap) NaviMap(app.hongs.action.NaviMap) Map(java.util.Map) RoleMap(app.hongs.serv.auth.RoleMap) Action(app.hongs.action.anno.Action) CommitSuccess(app.hongs.action.anno.CommitSuccess)

Aggregations

Action (app.hongs.action.anno.Action)63 Map (java.util.Map)52 HashMap (java.util.HashMap)38 NaviMap (app.hongs.action.NaviMap)16 CommitSuccess (app.hongs.action.anno.CommitSuccess)14 CoreLocale (app.hongs.CoreLocale)12 Preset (app.hongs.action.anno.Preset)12 IAction (app.hongs.dh.IAction)10 RoleMap (app.hongs.serv.auth.RoleMap)10 Verify (app.hongs.action.anno.Verify)9 FetchCase (app.hongs.db.util.FetchCase)8 CoreConfig (app.hongs.CoreConfig)7 Select (app.hongs.action.anno.Select)7 Set (java.util.Set)6 File (java.io.File)5 List (java.util.List)5 HongsException (app.hongs.HongsException)4 ActionRunner (app.hongs.action.ActionRunner)4 LuceneAction (app.hongs.dh.lucene.LuceneAction)3 SearchAction (app.hongs.dh.search.SearchAction)3