use of com.ganster.cms.core.exception.PermissionNotFoundException 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.core.exception.PermissionNotFoundException in project Ganster-CMS by Gangster-trio.
the class AllotPermissionController method addPermission.
@RequestMapping("/add")
@RequiresPermissions("add")
public void addPermission(@RequestParam("GroupName") String groupName, @RequestParam("PermissionName") String permissionName) throws PermissionNotFoundException, GroupNotFountException {
PermissionExample permissionExample = new PermissionExample();
permissionExample.createCriteria().andPermissionNameEqualTo(permissionName);
List<Permission> permissions = permissionService.selectByExample(permissionExample);
if (permissions == null)
throw new PermissionNotFoundException();
for (Permission i : permissions) {
// groupService.addCategoryPermissionToGroup(i.getPermissionName(),groupName);
}
}
Aggregations