Skip to content

Bug #14391 #883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -741,6 +741,27 @@ public synchronized void flushTrashCan() {
indexOfFirstPubToDisplay = 0;
}

/**
* Update the specified topic. If the local rights of the topic are enabled, then from the
* inherited rights, only the admin ones are kept.
* @param topic the topic to update with the updated data
* @param alertType the type of notification: notify all the users ("All"), only the publishers
* ("publisher"), or nobody ("None").
*/
public synchronized void updateTopic(NodeDetail topic, String alertType) {
NodeDetail previousTopic = getNodeHeader(topic.getId());
updateTopicHeader(topic, alertType);
if (!previousTopic.haveLocalRights() && topic.haveLocalRights()) {
initTopicSpecificAdminProfiles(topic.getNodePK(), topic.getFatherPK());
}
}

/**
* Update only header information about the specified topic.
* @param nd the topic to update with the updated data
* @param alertType the type of notification: notify all the users ("All"), only the publishers
* ("publisher"), or nobody ("None").
*/
public synchronized void updateTopicHeader(NodeDetail nd, String alertType) {
nd.getNodePK().setSpace(getSpaceId());
nd.getNodePK().setComponentName(getComponentId());
@@ -763,12 +784,19 @@ public synchronized NodePK addSubTopic(NodeDetail nd, String alertType, String p
nd.getNodePK().setSpace(getSpaceId());
nd.getNodePK().setComponentName(getComponentId());
nd.setCreatorId(getUserId());
NodePK pk = getKmeliaService().addSubTopic(getNodePK(parentId), nd, alertType);
NodePK parentPk = getNodePK(parentId);
NodePK pk = getKmeliaService().addSubTopic(parentPk, nd, alertType);
initTopicSpecificAdminProfiles(pk, parentPk);

return pk;
}

private void initTopicSpecificAdminProfiles(NodePK pk, NodePK parentPk) {
// by default, sets father's admin rights in the case of specific rights
// to prevent no access to users having some rights with the father topic
NodeDetail created = getNodeHeader(pk.getId());
if (created.haveLocalRights()) {
NodeDetail node = getNodeHeader(pk.getId());
String parentId = parentPk.getId();
if (node.haveLocalRights()) {
ProfileInst parentProfile;
String profileAdmin = SilverpeasRole.ADMIN.getName();
if (NodePK.ROOT_NODE_ID.equals(parentId)) {
@@ -782,8 +810,6 @@ public synchronized NodePK addSubTopic(NodeDetail nd, String alertType, String p
parentProfile.getAllUsers().toArray(new String[0]));
}
}

return pk;
}

public synchronized String deleteTopic(String topicId) {
Original file line number Diff line number Diff line change
@@ -135,7 +135,7 @@ public String getDestination(String function, KmeliaSessionController kmelia,
boolean kmaxMode = false;
boolean toolboxMode;
SilverpeasRole highestSilverpeasUserRoleOnCurrentTopic =
getHighestSilverpeasUserRoleOnCurrentTopic(kmelia, function);
getHighestSilverpeasUserRoleOnCurrentTopic(kmelia);
try {
if ("kmax".equals(kmelia.getComponentRootName())) {
kmaxMode = true;
@@ -503,7 +503,7 @@ public String getDestination(String function, KmeliaSessionController kmelia,
goToProfilesDefinition = true;
}
}
kmelia.updateTopicHeader(topic, alertType);
kmelia.updateTopic(topic, alertType);

if (goToProfilesDefinition) {
request.setAttribute("NodeId", id);
@@ -1487,7 +1487,7 @@ else if (function.equals("KmaxMain")) {

@NonNull
private static SilverpeasRole getHighestSilverpeasUserRoleOnCurrentTopic(
KmeliaSessionController kmelia, String function) {
KmeliaSessionController kmelia) {
return SilverpeasRole.fromString(kmelia.getUserTopicProfile(kmelia.getCurrentFolderId()));
}