/** * Tests if a user is member of the given group.<p> * * @param context the current request context * @param username the name of the user to check * @param groupname the name of the group to check * * @return <code>true</code>, if the user is in the group; or <code>false</code> otherwise * * @throws CmsException if operation was not successful */ public boolean userInGroup(CmsRequestContext context, String username, String groupname) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); boolean result = false; try { result = m_driverManager.userInGroup( dbc, CmsOrganizationalUnit.removeLeadingSeparator(username), CmsOrganizationalUnit.removeLeadingSeparator(groupname), false); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_USER_IN_GROUP_2, username, groupname), e); } finally { dbc.clear(); } return result; }
/** * Tests if a user is member of the given group.<p> * * @param context the current request context * @param username the name of the user to check * @param groupname the name of the group to check * * @return <code>true</code>, if the user is in the group; or <code>false</code> otherwise * * @throws CmsException if operation was not successful */ public boolean userInGroup(CmsRequestContext context, String username, String groupname) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); boolean result = false; try { result = m_driverManager.userInGroup( dbc, CmsOrganizationalUnit.removeLeadingSeparator(username), CmsOrganizationalUnit.removeLeadingSeparator(groupname), false); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_USER_IN_GROUP_2, username, groupname), e); } finally { dbc.clear(); } return result; }
while (itUsers.hasNext()) { CmsUser user = (CmsUser)itUsers.next(); if (userInGroup(dbc, user.getName(), group.getName(), group.isRole())) { removeUserFromGroup(dbc, user.getName(), group.getName(), group.isRole());
if (!userInGroup(dbc, username, roleName, true)) { addUserToGroup(dbc, username, roleName, true); return; if (userInGroup(dbc, username, groupname, readRoles)) {
if (!userInGroup(dbc, username, groupname, readRoles)) { while (it.hasNext()) { CmsGroup virtualGroup = it.next(); if (userInGroup(dbc, username, virtualGroup.getName(), false)) {
while (itUsers.hasNext()) { CmsUser user = itUsers.next(); if (userInGroup(dbc, user.getName(), group.getName(), group.isRole())) { removeUserFromGroup(dbc, user.getName(), group.getName(), group.isRole());
if (!userInGroup(dbc, username, groupname, readRoles)) { while (it.hasNext()) { CmsGroup virtualGroup = (CmsGroup)it.next(); if (userInGroup(dbc, username, virtualGroup.getName(), false)) {
if (userInGroup(dbc, username, groupname, readRoles)) {
if (!isVfsManager) { if (!userInGroup(dbc, replacementUser.getName(), group.getName(), readRoles)) { addUserToGroup(dbc, replacementUser.getName(), group.getName(), readRoles); if (userInGroup(dbc, username, group.getName(), readRoles)) {
if (!isVfsManager) { if (!userInGroup(dbc, replacementUser.getName(), group.getName(), readRoles)) { addUserToGroup(dbc, replacementUser.getName(), group.getName(), readRoles);