use of org.camunda.bpm.engine.impl.persistence.entity.GroupEntity in project camunda-bpm-platform by camunda.
the class DbIdentityServiceProvider method saveGroup.
public GroupEntity saveGroup(Group group) {
GroupEntity groupEntity = (GroupEntity) group;
if (groupEntity.getRevision() == 0) {
checkAuthorization(Permissions.CREATE, Resources.GROUP, null);
getDbEntityManager().insert(groupEntity);
createDefaultAuthorizations(group);
} else {
checkAuthorization(Permissions.UPDATE, Resources.GROUP, group.getId());
getDbEntityManager().merge(groupEntity);
}
return groupEntity;
}
use of org.camunda.bpm.engine.impl.persistence.entity.GroupEntity in project camunda-bpm-platform by camunda.
the class DbIdentityServiceProvider method createTenantGroupMembership.
public void createTenantGroupMembership(String tenantId, String groupId) {
checkAuthorization(Permissions.CREATE, Resources.TENANT_MEMBERSHIP, tenantId);
TenantEntity tenant = findTenantById(tenantId);
GroupEntity group = findGroupById(groupId);
ensureNotNull("No tenant found with id '" + tenantId + "'.", "tenant", tenant);
ensureNotNull("No group found with id '" + groupId + "'.", "group", group);
TenantMembershipEntity membership = new TenantMembershipEntity();
membership.setTenant(tenant);
membership.setGroup(group);
getDbEntityManager().insert(membership);
createDefaultTenantMembershipAuthorizations(tenant, group);
}
use of org.camunda.bpm.engine.impl.persistence.entity.GroupEntity in project camunda-bpm-platform by camunda.
the class LdapIdentityProviderSession method findGroupByQueryCriteria.
public List<Group> findGroupByQueryCriteria(LdapGroupQuery query) {
ensureContextInitialized();
String groupBaseDn = composeDn(ldapConfiguration.getGroupSearchBase(), ldapConfiguration.getBaseDn());
if (ldapConfiguration.isSortControlSupported()) {
applyRequestControls(query);
}
NamingEnumeration<SearchResult> enumeration = null;
try {
String filter = getGroupSearchFilter(query);
enumeration = initialContext.search(groupBaseDn, filter, ldapConfiguration.getSearchControls());
// perform client-side paging
int resultCount = 0;
List<Group> groupList = new ArrayList<Group>();
while (enumeration.hasMoreElements() && groupList.size() < query.getMaxResults()) {
SearchResult result = enumeration.nextElement();
GroupEntity group = transformGroup(result);
if (isAuthorized(READ, GROUP, group.getId())) {
if (resultCount >= query.getFirstResult()) {
groupList.add(group);
}
resultCount++;
}
}
return groupList;
} catch (NamingException e) {
throw new IdentityProviderException("Could not query for users", e);
} finally {
try {
if (enumeration != null) {
enumeration.close();
}
} catch (Exception e) {
// ignore silently
}
}
}
use of org.camunda.bpm.engine.impl.persistence.entity.GroupEntity in project camunda-bpm-platform by camunda.
the class DbIdentityServiceProvider method createMembership.
// membership //////////////////////////////////////////////////////
public void createMembership(String userId, String groupId) {
checkAuthorization(Permissions.CREATE, Resources.GROUP_MEMBERSHIP, groupId);
UserEntity user = findUserById(userId);
GroupEntity group = findGroupById(groupId);
MembershipEntity membership = new MembershipEntity();
membership.setUser(user);
membership.setGroup(group);
getDbEntityManager().insert(membership);
createDefaultMembershipAuthorizations(userId, groupId);
}
use of org.camunda.bpm.engine.impl.persistence.entity.GroupEntity in project camunda-bpm-platform by camunda.
the class DbIdentityServiceProvider method deleteGroup.
public void deleteGroup(String groupId) {
checkAuthorization(Permissions.DELETE, Resources.GROUP, groupId);
GroupEntity group = findGroupById(groupId);
if (group != null) {
deleteMembershipsByGroupId(groupId);
deleteTenantMembershipsOfGroup(groupId);
deleteAuthorizations(Resources.GROUP, groupId);
getDbEntityManager().delete(group);
}
}
Aggregations