use of com.netsteadfast.greenstep.po.hbm.TbUserRole in project bamboobsc by billchen198318.
the class RoleLogicServiceImpl method deleteUserRoleByAccount.
private void deleteUserRoleByAccount(AccountVO account) throws ServiceException, Exception {
Map<String, Object> params = new HashMap<String, Object>();
params.put("account", account.getAccount());
List<TbUserRole> userRoleList = this.userRoleService.findListByParams(params);
if (userRoleList == null || userRoleList.size() < 1) {
return;
}
for (TbUserRole userRole : userRoleList) {
this.userRoleService.delete(userRole);
}
}
use of com.netsteadfast.greenstep.po.hbm.TbUserRole in project bamboobsc by billchen198318.
the class GreenStepBaseAuthorizingLdapRealm method getSimpleAuthorizationInfo.
private SimpleAuthorizationInfo getSimpleAuthorizationInfo(String username) throws Exception {
Map<String, Object> params = new HashMap<String, Object>();
params.put("account", username);
List<TbUserRole> roleList = userRoleService.findListByParams(params);
if (roleList == null) {
return null;
}
SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
for (TbUserRole userRole : roleList) {
info.addRole(userRole.getRole());
params.clear();
params.put("role", userRole.getRole());
List<TbRolePermission> rolePermissionList = rolePermissionService.findListByParams(params);
if (rolePermissionList == null) {
continue;
}
for (TbRolePermission rolePermission : rolePermissionList) {
info.addStringPermission(rolePermission.getPermission());
}
}
return info;
}
use of com.netsteadfast.greenstep.po.hbm.TbUserRole in project bamboobsc by billchen198318.
the class ReportRoleViewLogicServiceImpl method findForOrganization.
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Override
public List<BbOrganization> findForOrganization(String accountId) throws ServiceException, Exception {
if (super.isBlank(accountId)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
List<BbOrganization> searchList = new ArrayList<BbOrganization>();
List<TbUserRole> roles = this.getUserRoles(accountId);
for (int i = 0; roles != null && i < roles.size(); i++) {
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("role", roles.get(i).getRole());
paramMap.put("type", ReportRoleViewTypes.IS_ORGANIZATION);
List<BbReportRoleView> views = this.reportRoleViewService.findListByParams(paramMap);
for (int j = 0; views != null && j < views.size(); j++) {
BbOrganization organization = new BbOrganization();
organization.setOrgId(views.get(j).getIdName());
organization = this.getOrganizationService().findByEntityUK(organization);
if (organization == null) {
continue;
}
boolean isFound = false;
for (BbOrganization entity : searchList) {
if (entity.getOid().equals(organization.getOid())) {
isFound = true;
}
}
if (!isFound) {
searchList.add(organization);
}
}
}
return searchList;
}
use of com.netsteadfast.greenstep.po.hbm.TbUserRole in project bamboobsc by billchen198318.
the class EmployeeLogicServiceImpl method delete.
@ServiceMethodAuthority(type = { ServiceMethodType.DELETE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> delete(EmployeeVO employee) throws ServiceException, Exception {
if (employee == null || super.isBlank(employee.getOid())) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
employee = this.findEmployeeData(employee.getOid());
AccountVO account = this.findAccountData(employee.getAccount());
if (this.isAdministrator(account.getAccount())) {
throw new ServiceException("Administrator cannot delete!");
}
// check account data for other table use.
this.checkInformationRelated(account, employee);
this.deleteEmployeeOrganization(employee);
// delete user role
Map<String, Object> params = new HashMap<String, Object>();
params.put("account", account.getAccount());
List<TbUserRole> userRoles = this.getUserRoleService().findListByParams(params);
for (int i = 0; userRoles != null && i < userRoles.size(); i++) {
TbUserRole uRole = userRoles.get(i);
this.getUserRoleService().delete(uRole);
}
// delete BB_REPORT_ROLE_VIEW
params.clear();
params.put("idName", account.getAccount());
List<BbReportRoleView> reportRoleViews = this.reportRoleViewService.findListByParams(params);
for (int i = 0; reportRoleViews != null && i < reportRoleViews.size(); i++) {
BbReportRoleView reportRoleView = reportRoleViews.get(i);
this.reportRoleViewService.delete(reportRoleView);
}
// delete from BB_MEASURE_DATA where EMP_ID = :empId
this.measureDataService.deleteForEmpId(employee.getEmpId());
this.monitorItemScoreService.deleteForEmpId(employee.getEmpId());
this.deleteHierarchy(employee);
this.getAccountService().deleteByPKng(account.getOid());
return getEmployeeService().deleteObject(employee);
}
use of com.netsteadfast.greenstep.po.hbm.TbUserRole in project bamboobsc by billchen198318.
the class GreenStepBaseAuthorizingRealm method getSimpleAuthorizationInfo.
private SimpleAuthorizationInfo getSimpleAuthorizationInfo(String username) throws Exception {
Map<String, Object> params = new HashMap<String, Object>();
params.put("account", username);
List<TbUserRole> roleList = userRoleService.findListByParams(params);
if (roleList == null) {
return null;
}
SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
for (TbUserRole userRole : roleList) {
info.addRole(userRole.getRole());
params.clear();
params.put("role", userRole.getRole());
List<TbRolePermission> rolePermissionList = rolePermissionService.findListByParams(params);
if (rolePermissionList == null) {
continue;
}
for (TbRolePermission rolePermission : rolePermissionList) {
info.addStringPermission(rolePermission.getPermission());
}
}
return info;
}
Aggregations