use of com.ganster.cms.auth.util.RInformationUtil in project Ganster-CMS by Gangster-trio.
the class AllotGroupController method addGroup.
@RequestMapping("/add")
public void addGroup(@RequestParam(value = "UserId") Integer userId, @RequestParam(value = "GroupName") String groupName) {
this.index();
GroupExample groupExample = new GroupExample();
groupExample.createCriteria().andGroupNameEqualTo(groupName);
List<Group> groupList = groupService.selectByExample(groupExample);
if (userId != null) {
try {
if (groupList == null) {
RInformationUtil rInformationUtil = new RInformationUtil();
rInformationUtil.dealInfromation(groupName);
Group group = new Group();
group.setGroupName(groupName);
groupService.insert(group);
groupService.addUserToGroup(userId, groupName);
// groupService.addCategoryPermissionToGroup(groupName,"update:"+group.getGroupId());
// groupService.addCategoryPermissionToGroup(groupName, "delete:" + group.getGroupId());
// groupService.addCategoryPermissionToGroup(groupName,"find:"+group.getGroupId());
} else {
for (Group i : groupList) {
groupService.addUserToGroup(userId, i.getGroupName());
}
}
} catch (UserNotFoundException e) {
logger.info("用户未找到");
} catch (GroupNotFountException e) {
logger.info("用户组未找到");
} catch (InformationException e) {
logger.info("用户组信息不正确");
} catch (PermissionNotFoundException e) {
logger.info("用户组未找到");
} catch (Exception e) {
logger.info("信息错误");
}
}
}
use of com.ganster.cms.auth.util.RInformationUtil in project Ganster-CMS by Gangster-trio.
the class AllotGroupController method index.
public String index() {
RInformationUtil rInformationUtil = new RInformationUtil();
Subject subject = SecurityUtils.getSubject();
Integer id = (Integer) subject.getSession().getAttribute("id");
List<Group> group = groupService.selectByUserId(id);
List<String> groupName = new ArrayList<>();
for (Group i : group) {
try {
rInformationUtil.dealInfromation(i.getGroupName());
groupName.add(rInformationUtil.getRolename());
} catch (Exception e) {
logger.info("++++++++++++++++++++ index 错误++++++++++++++++++++");
return "/403.html";
}
}
for (String i : groupName) {
if (groupName.equals("group"))
return "ok";
}
return "/login/403.html";
}
Aggregations