use of com.ngtesting.platform.entity.TestProjectRoleForOrg in project ngtesting-platform by aaronchen2k.
the class ProjectPrivilegeServiceImpl method addUserAsProjectRolePers.
@Override
public boolean addUserAsProjectRolePers(Long orgId, Long projectId, String roleCode, Long userId) {
DetachedCriteria dc = DetachedCriteria.forClass(TestProjectRoleForOrg.class);
dc.add(Restrictions.eq("orgId", orgId));
dc.add(Restrictions.eq("code", "test_leader"));
dc.add(Restrictions.eq("deleted", Boolean.FALSE));
dc.add(Restrictions.eq("disabled", Boolean.FALSE));
dc.addOrder(Order.asc("id"));
List<TestProjectRoleForOrg> ls = findAllByCriteria(dc);
if (ls.size() == 0) {
return false;
}
TestProjectRoleForOrg role = ls.get(0);
TestRelationProjectRoleEntity relation = new TestRelationProjectRoleEntity(projectId, userId, role.getId(), "user");
saveOrUpdate(relation);
return true;
}
Aggregations