@@ -741,6 +741,27 @@ public synchronized void flushTrashCan() {
741
741
indexOfFirstPubToDisplay = 0 ;
742
742
}
743
743
744
+ /**
745
+ * Update the specified topic. If the local rights of the topic are enabled, then from the
746
+ * inherited rights, only the admin ones are kept.
747
+ * @param topic the topic to update with the updated data
748
+ * @param alertType the type of notification: notify all the users ("All"), only the publishers
749
+ * ("publisher"), or nobody ("None").
750
+ */
751
+ public synchronized void updateTopic (NodeDetail topic , String alertType ) {
752
+ NodeDetail previousTopic = getNodeHeader (topic .getId ());
753
+ updateTopicHeader (topic , alertType );
754
+ if (!previousTopic .haveLocalRights () && topic .haveLocalRights ()) {
755
+ initTopicSpecificAdminProfiles (topic .getNodePK (), topic .getFatherPK ());
756
+ }
757
+ }
758
+
759
+ /**
760
+ * Update only header information about the specified topic.
761
+ * @param nd the topic to update with the updated data
762
+ * @param alertType the type of notification: notify all the users ("All"), only the publishers
763
+ * ("publisher"), or nobody ("None").
764
+ */
744
765
public synchronized void updateTopicHeader (NodeDetail nd , String alertType ) {
745
766
nd .getNodePK ().setSpace (getSpaceId ());
746
767
nd .getNodePK ().setComponentName (getComponentId ());
@@ -763,12 +784,19 @@ public synchronized NodePK addSubTopic(NodeDetail nd, String alertType, String p
763
784
nd .getNodePK ().setSpace (getSpaceId ());
764
785
nd .getNodePK ().setComponentName (getComponentId ());
765
786
nd .setCreatorId (getUserId ());
766
- NodePK pk = getKmeliaService ().addSubTopic (getNodePK (parentId ), nd , alertType );
787
+ NodePK parentPk = getNodePK (parentId );
788
+ NodePK pk = getKmeliaService ().addSubTopic (parentPk , nd , alertType );
789
+ initTopicSpecificAdminProfiles (pk , parentPk );
790
+
791
+ return pk ;
792
+ }
767
793
794
+ private void initTopicSpecificAdminProfiles (NodePK pk , NodePK parentPk ) {
768
795
// by default, sets father's admin rights in the case of specific rights
769
796
// to prevent no access to users having some rights with the father topic
770
- NodeDetail created = getNodeHeader (pk .getId ());
771
- if (created .haveLocalRights ()) {
797
+ NodeDetail node = getNodeHeader (pk .getId ());
798
+ String parentId = parentPk .getId ();
799
+ if (node .haveLocalRights ()) {
772
800
ProfileInst parentProfile ;
773
801
String profileAdmin = SilverpeasRole .ADMIN .getName ();
774
802
if (NodePK .ROOT_NODE_ID .equals (parentId )) {
@@ -782,8 +810,6 @@ public synchronized NodePK addSubTopic(NodeDetail nd, String alertType, String p
782
810
parentProfile .getAllUsers ().toArray (new String [0 ]));
783
811
}
784
812
}
785
-
786
- return pk ;
787
813
}
788
814
789
815
public synchronized String deleteTopic (String topicId ) {
0 commit comments