use of org.mx.dal.session.SessionDataStore in project main by JohnPeng739.
the class InitializeAdminAccountTask method invokeTask.
/**
* {@inheritDoc}
* <p>
* 初始化系统数据的任务,包括:admin、user、guest角色,以及admin、guest账户。
*
* @see InitializeTask#invokeTask()
*/
@Override
public void invokeTask() {
GeneralDictAccessor accessor = SpringContextHolder.getBean("generalDictAccessor", GeneralDictAccessor.class);
SessionDataStore sessionDataStore = SpringContextHolder.getBean(SessionDataStore.class);
sessionDataStore.setCurrentUserCode("system");
// 创建相关的角色
createRole(accessor, "admin", "系统管理员", "系统管理员角色");
createRole(accessor, "user", "用户", "一般业务操作用户角色");
createRole(accessor, "guest", "客人", "客人访问角色,只能不需要权限认证的功能");
// 创建相关的账户
createAccount(accessor, "admin", "系统管理员", "ds110119", "系统管理员账户", "admin");
createAccount(accessor, "guest", "客人", "guest", "客人账户", "guest");
sessionDataStore.removeCurrentUserCode();
}
use of org.mx.dal.session.SessionDataStore in project main by JohnPeng739.
the class BaseTest method before.
@Before
public void before() {
try {
IMongodConfig config = new MongodConfigBuilder().version(Version.Main.PRODUCTION).net(new Net("localhost", 27017, Network.localhostIsIPv6())).build();
mongodExecutable = MongodStarter.getDefaultInstance().prepare(config);
mongod = mongodExecutable.start();
context = new AnnotationConfigApplicationContext(CompsRbacMongodbConfig.class);
SessionDataStore sessionDataStore = context.getBean(SessionDataStore.class);
assertNotNull(sessionDataStore);
sessionDataStore.setCurrentUserCode("admin");
} catch (Exception ex) {
ex.printStackTrace();
fail(ex.getMessage());
}
}
use of org.mx.dal.session.SessionDataStore in project main by JohnPeng739.
the class BaseTest method before.
@Before
public void before() {
CleanH2DatabaseFile.cleanDataFile("./h2/test");
context = new AnnotationConfigApplicationContext(TestDalConfig.class);
assertNotNull(context);
SessionDataStore sessionDataStore = context.getBean(SessionDataStore.class);
assertNotNull(sessionDataStore);
sessionDataStore.setCurrentUserCode("admin");
}
Aggregations