Bug #692 » patchBug692.patch
src/main/java/com/stratelia/webactiv/beans/admin/Admin.java (working copy) | ||
---|---|---|
import com.stratelia.silverpeas.util.SilverpeasSettings;
|
||
import com.stratelia.webactiv.SilverpeasRole;
|
||
import com.stratelia.webactiv.beans.admin.cache.AdminCache;
|
||
import com.stratelia.webactiv.beans.admin.cache.GroupCache;
|
||
import com.stratelia.webactiv.beans.admin.cache.Space;
|
||
import com.stratelia.webactiv.beans.admin.cache.TreeCache;
|
||
import com.stratelia.webactiv.beans.admin.instance.control.Instanciateur;
|
||
... | ... | |
String componentName = componentInst.getName();
|
||
String componentId = componentName + componentInst.getId();
|
||
String[] asCompoNames = {componentName};
|
||
String[] asCompoIds = {componentId};
|
||
String[] asCompoNames = { componentName };
|
||
String[] asCompoIds = { componentId };
|
||
instantiateComponents(sUserId, asCompoIds, asCompoNames, spaceInstFather.getId(),
|
||
connectionProd);
|
||
... | ... | |
// Uninstantiate the components
|
||
String componentName = componentInst.getName();
|
||
String[] asCompoName = {componentName};
|
||
String[] asCompoId = {sClientComponentId};
|
||
String[] asCompoName = { componentName };
|
||
String[] asCompoId = { sClientComponentId };
|
||
unInstantiateComponents(sUserId, asCompoId, asCompoName,
|
||
getClientSpaceId(sFatherClientId), connectionProd);
|
||
... | ... | |
m_Cache.resetComponentInst();
|
||
// reset treecache list in old and new spaces
|
||
TreeCache.setComponents(getDriverSpaceId(oldSpaceId), m_ComponentInstManager.getComponentsInSpace(Integer.parseInt(getDriverSpaceId(oldSpaceId))));
|
||
TreeCache.setComponents(getDriverSpaceId(spaceId), m_ComponentInstManager.getComponentsInSpace(Integer.parseInt(getDriverSpaceId(spaceId))));
|
||
TreeCache.setComponents(getDriverSpaceId(oldSpaceId), m_ComponentInstManager
|
||
.getComponentsInSpace(Integer.parseInt(getDriverSpaceId(oldSpaceId))));
|
||
TreeCache.setComponents(getDriverSpaceId(spaceId), m_ComponentInstManager
|
||
.getComponentsInSpace(Integer.parseInt(getDriverSpaceId(spaceId))));
|
||
} catch (Exception e) {
|
||
rollback();
|
||
throw new AdminException("Admin.moveComponentInst",
|
||
... | ... | |
List<String> groups = getAllGroupsOfUser(userId);
|
||
return m_ProfiledObjectManager.getUserProfileNames(objectId, objectType, Integer.parseInt(getDriverComponentId(componentId)),
|
||
return m_ProfiledObjectManager.getUserProfileNames(objectId, objectType, Integer
|
||
.parseInt(getDriverComponentId(componentId)),
|
||
Integer.parseInt(userId), groups);
|
||
}
|
||
... | ... | |
m_DDManager.startTransaction(false);
|
||
GroupProfileInst oldSpaceProfile =
|
||
m_GroupProfileInstManager.getGroupProfileInst(m_DDManager, null, groupProfileInstNew.getGroupId());
|
||
m_GroupProfileInstManager.getGroupProfileInst(m_DDManager, null, groupProfileInstNew
|
||
.getGroupId());
|
||
// Update the group profile in tables
|
||
m_GroupProfileInstManager.updateGroupProfileInst(oldSpaceProfile,
|
||
... | ... | |
}
|
||
private List<String> getAllGroupsOfUser(String userId) throws AdminException {
|
||
List<String> allGroupsOfUser = new ArrayList<String>();
|
||
String[] directGroupIds = m_GroupManager.getDirectGroupsOfUser(m_DDManager, userId);
|
||
for (int g = 0; g < directGroupIds.length; g++) {
|
||
Group group = m_GroupManager.getGroup(directGroupIds[g], false); // TODO: cacher les groupes
|
||
if (group != null) {
|
||
allGroupsOfUser.add(group.getId());
|
||
while (StringUtil.isDefined(group.getSuperGroupId())) {
|
||
group = m_GroupManager.getGroup(group.getSuperGroupId(), false);
|
||
if (group != null) {
|
||
allGroupsOfUser.add(group.getId());
|
||
List<String> allGroupsOfUser = GroupCache.getAllGroupIdsOfUser(userId);
|
||
if (allGroupsOfUser == null) {
|
||
// group ids of user is not yet processed
|
||
// process it and store it in cache
|
||
allGroupsOfUser = new ArrayList<String>();
|
||
String[] directGroupIds = m_GroupManager.getDirectGroupsOfUser(m_DDManager, userId);
|
||
for (int g = 0; g < directGroupIds.length; g++) {
|
||
Group group = m_GroupManager.getGroup(directGroupIds[g], false);
|
||
if (group != null) {
|
||
allGroupsOfUser.add(group.getId());
|
||
while (StringUtil.isDefined(group.getSuperGroupId())) {
|
||
group = m_GroupManager.getGroup(group.getSuperGroupId(), false);
|
||
if (group != null) {
|
||
allGroupsOfUser.add(group.getId());
|
||
}
|
||
}
|
||
}
|
||
}
|
||
// store groupIds of user in cache
|
||
GroupCache.setAllGroupIdsOfUser(userId, allGroupsOfUser);
|
||
}
|
||
return allGroupsOfUser;
|
||
}
|
||
... | ... | |
// All users by access level
|
||
if (domainId == null) {
|
||
userIds =
|
||
Arrays.asList(m_DDManager.organization.user.getUserIdsByAccessLevel(accessLevel));
|
||
Arrays.asList(m_DDManager.organization.user
|
||
.getUserIdsByAccessLevel(accessLevel));
|
||
} else {
|
||
userIds =
|
||
Arrays.asList(m_UserManager.getUserIdsOfDomainAndAccessLevel(m_DDManager,
|
||
... | ... | |
// Available only for "domaine mixte"
|
||
if ("-1".equals(domainId)) {
|
||
userIds =
|
||
Arrays.asList(m_DDManager.organization.user.getUserIdsOfDomain(Integer.parseInt(dId)));
|
||
Arrays.asList(m_DDManager.organization.user.getUserIdsOfDomain(Integer
|
||
.parseInt(dId)));
|
||
}
|
||
}
|
||
} else if (rule.toLowerCase().startsWith("dc_")) {
|
||
... | ... | |
}
|
||
}
|
||
if ((parentId == null)
|
||
&& ((parentSpecificIds.length > 0) || ((askedParentId != null) && (askedParentId.length() > 0)))) {// We
|
||
&&
|
||
((parentSpecificIds.length > 0) || ((askedParentId != null) && (askedParentId.length() > 0)))) {// We
|
||
// can't
|
||
// add
|
||
// the
|
||
... | ... | |
existingGroupId = null;
|
||
try {
|
||
existingGroupId =
|
||
m_GroupManager.getGroupIdBySpecificIdAndDomainId(m_DDManager, childs[i].getSpecificId(), latestGroup.getDomainId());
|
||
m_GroupManager.getGroupIdBySpecificIdAndDomainId(m_DDManager, childs[i]
|
||
.getSpecificId(), latestGroup.getDomainId());
|
||
existingGroup = getGroup(existingGroupId);
|
||
if (existingGroup.getSuperGroupId().equals(latestGroup.getId())) { // Only
|
||
// synchronize
|
src/main/java/com/stratelia/webactiv/beans/admin/cache/GroupCache.java (revision 0) | ||
---|---|---|
/**
|
||
* Copyright (C) 2000 - 2009 Silverpeas
|
||
*
|
||
* This program is free software: you can redistribute it and/or modify
|
||
* it under the terms of the GNU Affero General Public License as
|
||
* published by the Free Software Foundation, either version 3 of the
|
||
* License, or (at your option) any later version.
|
||
*
|
||
* As a special exception to the terms and conditions of version 3.0 of
|
||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||
* Open Source Software ("FLOSS") applications as described in Silverpeas's
|
||
* FLOSS exception. You should have received a copy of the text describing
|
||
* the FLOSS exception, and it is also available here:
|
||
* "http://repository.silverpeas.com/legal/licensing"
|
||
*
|
||
* This program is distributed in the hope that it will be useful,
|
||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
* GNU Affero General Public License for more details.
|
||
*
|
||
* You should have received a copy of the GNU Affero General Public License
|
||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
*/
|
||
package com.stratelia.webactiv.beans.admin.cache;
|
||
import java.util.List;
|
||
import java.util.concurrent.ConcurrentHashMap;
|
||
import java.util.concurrent.ConcurrentMap;
|
||
public class GroupCache {
|
||
private static ConcurrentMap<String, List<String>> map =
|
||
new ConcurrentHashMap<String, List<String>>();
|
||
public static void clearCache() {
|
||
map.clear();
|
||
}
|
||
public static List<String> getAllGroupIdsOfUser(String userId) {
|
||
return map.get(userId);
|
||
}
|
||
public static void setAllGroupIdsOfUser(String userId, List<String> groupIds) {
|
||
map.put(userId, groupIds);
|
||
}
|
||
|
||
public static void removeCacheOfUser(String userId) {
|
||
map.remove(userId);
|
||
}
|
||
}
|
src/main/java/com/stratelia/webactiv/organization/GroupTable.java (working copy) | ||
---|---|---|
import com.stratelia.silverpeas.silvertrace.SilverTrace;
|
||
import com.stratelia.webactiv.beans.admin.SynchroGroupReport;
|
||
import com.stratelia.webactiv.beans.admin.SynchroReport;
|
||
import com.stratelia.webactiv.beans.admin.cache.GroupCache;
|
||
import com.stratelia.webactiv.util.exception.SilverpeasException;
|
||
/**
|
||
... | ... | |
"Ajout de l'utilisateur d'ID " + userId + " dans le groupe d'ID "
|
||
+ groupId + ", requête : " + INSERT_A_GROUP_USER_REL, null);
|
||
updateRelation(INSERT_A_GROUP_USER_REL, params);
|
||
GroupCache.removeCacheOfUser(Integer.toString(userId));
|
||
}
|
||
/**
|
||
... | ... | |
"Ajout de l'utilisateur d'ID " + userId + " dans le groupe d'ID "
|
||
+ groupId + ", requête : " + INSERT_A_GROUP_USER_REL, null);
|
||
updateRelation(INSERT_A_GROUP_USER_REL, params);
|
||
GroupCache.removeCacheOfUser(Integer.toString(userId));
|
||
}
|
||
}
|
||
}
|
||
... | ... | |
"Retrait de l'utilisateur d'ID " + userId + " du groupe d'ID "
|
||
+ groupId + ", requête : " + DELETE_GROUP_USER_REL, null);
|
||
updateRelation(DELETE_GROUP_USER_REL, params);
|
||
GroupCache.removeCacheOfUser(Integer.toString(userId));
|
||
}
|
||
static final private String DELETE_GROUP_USER_REL =
|
||
... | ... | |
"Retrait de l'utilisateur d'ID " + userId + " du groupe d'ID "
|
||
+ groupId + ", requête : " + DELETE_GROUP_USER_REL, null);
|
||
updateRelation(DELETE_GROUP_USER_REL, params);
|
||
GroupCache.removeCacheOfUser(Integer.toString(userId));
|
||
} else {
|
||
throw new AdminPersistenceException(
|
||
"GroupTable.removeUsersFromGroup()", SilverpeasException.ERROR,
|