Willkommen bei der Verwaltung von Bereiche und Anwendungen
Silverpeas wird in Bereiche, die Anwendungen enthalten strukturiert. Jeder Bereich kann auch Unterbereiche enthalten.
-Eine breite Palette von gebrauchsfertigen Anwendunge werden angeboten um alle Ihre Bedürfnisse zu erfüllen: Dokumenten-Management, Bildergalerie, Blog, Umfragen, Projektmanagement ...
-Als Administrator können Sie alle Bereiche und Anwendungen verwalten.
+$if(communityEnabled)$
+Neben den Bereiche ist es möglich, Communities zu erstellen. Dabei handelt es sich um besondere Bereiche, denen die Nutzer selbst beitreten möchten, anstatt dass ihnen ein Administrator den Zugang gewährt.
+
+$endif$
+Eine breite Palette an einsatzbereiten Anwendungen steht zur Verfügung, um all Ihren Anforderungen gerecht zu werden: Dokumentenmanagement, Bildergalerie, Blog, Umfragen, Projektmanagement...
+Als Administrator können Sie alle Bereiche und Anwendungen verwalten.
-
Es ist sehr einfach, die Struktur Ihrer Plattform zu ändern!
-
Sie können schnell, unter diesem Link, einen Wurzelbereich erstellen oder, Sie können über das "Was wollen Sie tun ?" Menü einen Bereich erstellen . Was wollen Sie als Nächstes tun ?.
-
Alle First-Level-Bereiche sind über der Dropdown-Liste auf der linken Seite zugänglich. So bearbeiten, löschen oder verwalten Sie einen Bereich, wählen Sie es einfach aus dieser Liste.
-Der Inhalt des ausgewählten Bereichs wird dann in dieser Liste angezeigt.
-Alle Operationen auf diesem Bereich sind über das Menü Was wollen Sie tun ? erreichbar.
-Sie können insbesondere:
+
Es ist sehr einfach, die Struktur Ihrer Plattform zu ändern!
+
Sie können schnell einen Bereich der ersten Ebene erstellen, indem Sie hier klicken oder im Menü Was möchten Sie tun? den Befehl Bereich erstellen auswählen..
+
Alle Bereiche der ersten Ebene sind in der Dropdown-Liste auf der linken Seite zugänglich. Um einen Bereich zu ändern, zu löschen oder zu ergänzen, wählen Sie ihn einfach aus dieser Liste aus.
+Der Inhalt des ausgewählten Bereichs wird dann unter dieser Dropdown-Liste angezeigt. Alle für den ausgewählten Bereich verfügbaren Vorgänge sind über das Menü Was möchten Sie tun? zugänglich. Sie können insbesondere:
-
Anwendungen Hinzufügen, Bearbeiten oder Entfernen,
-
die Zugriffsrechte, die für diese Anwendungen gelten definieren,
-
Verwaltung jedem Benutzer delegieren,
-
eine bestimmte Startseite definieren,
+
Anwendungen hinzufügen, ändern oder löschen
+
die für diese Anwendungen geltenden Zugriffsrechte festlegen,
+
die Verwaltung an beliebige Benutzer delegieren,
+
eine bestimmte Startseite festlegen,
...
-
Um einen Unterbereich oder eine Anwendung zu verwalten, klicken Sie auf ihren Namen. Es wird Ihnen den Zugriff auf alle mögliche Operationen, über das Menü Was wollen Sie tun ? erlaubt.
+
Um einen Unterbereich oder eine Anwendung zu ändern, wählen Sie diese aus, um Zugriff auf alle zugehörigen Vorgänge zu erhalten. Auch hierfür steht Ihnen das Menü Was möchten Sie tun? zur Verfügung.
-
Oooops Ich habe den falschen Bereich gelöscht!
-
Um zu vermeiden dass ein Benutzer eine falsche Handlung macht, werden Bereiche und Anwendungen, nicht dauerhaft gelöscht.
-Man findet sie immer im Papierkorb.
-Der Papierkorb ist nur für Administratoren zugänglich. So sind Sie der einzige, der dauerhaft Bereiche oder Anwendungen löschen kann.
-Beachten Sie, dass Sie bei der Wiederherstellung eines Bereichs oder einer Anwendung neue spezifische Zugangsrechte gewähren müssen.
+
Puh... der Papierkorb für Bereiche und Anwendungen ist da!
+
Um Schäden durch unsachgemäße Handhabung zu vermeiden, werden Bereiche und Anwendungen nicht endgültig gelöscht.
+Vor ihrer endgültigen Löschung können sie über den Papierkorb wiederhergestellt werden, indem Sie hier klicken oder im Menü „Was möchten Sie tun?“ den Befehl „Papierkorb für Bereiche und Anwendungen“ auswählen. .
+Dieser Papierkorb ist Administratoren vorbehalten. Sie sind also die Einzigen, die Bereiche oder Anwendungen wiederherstellen und endgültig löschen können.
+Beachten Sie, dass bei der Wiederherstellung die spezifischen Rechte neu definiert werden müssen.
-
Maintenance-Modus
-
Dieser Modus ermöglicht es Ihnen den Zugriff auf der Plattform zu schließen.
-Nur Administratoren können auf die Plattform zugreifen, es ist also nützlich für große Veränderungen.
-Dieser Modus ist auch in jedem Bereich zur Verfügung. Die Nutzer werden von der vorübergehende Nichtverfügbarkeit gewarnt werden.
+
Der Wartungsmodus
+
Dieser Modus ermöglicht es, die Plattform vorübergehend nicht verfügbar zu machen.
+Dies ist bei umfangreichen Änderungen nützlich, da nur Administratoren auf die Plattform und ihre Inhalte zugreifen können.
+Dieser Modus ist auch auf Ebene jedes Bereichs über die Option Wartungsmodus aktivieren im Menü Was möchten Sie tun? verfügbar. In diesem Fall werden die Benutzer durch eine Meldung über die vorübergehende Nichtverfügbarkeit informiert.
Silverpeas is structured into spaces that contain applications. Each space may also contains sub-spaces.
-A wide range of applications ready to use is offered to meet all your needs : document management, image gallery, blog, surveys, project management...
+$if(communityEnabled)$
+Beside the spaces, it is possible to create communities. Those are peculiar spaces that users themselves request to join, rather than having one administrator grants them access.
+
+$endif$
+A wide range of applications ready to use is provided to meet all your needs : document management, image gallery, blog, surveys, project management...
As an administrator you can manage all spaces and applications.
-
It's very easy to change the structure of your platform !
-
You can create a root space quickly following this link or when following right corner operation Create a space from menu What do you want to do next ?.
+
It's very easy to change the structure of your platform!
+
You can create a root space quickly following this link or when following right corner operation Create a space from menu What do you want to do next?.
All first-level spaces are accessible in the drop-down list on the left. To edit, delete or manage a space, simply select it from this list.
The content of the selected space will then appear in this list.
All the operations available on this space are accessible via the menu What do you want to do next?.
diff --git a/core-configuration/src/main/config/resources/StringTemplates/admin/space/welcome_space_admin_fr.st b/core-configuration/src/main/config/resources/StringTemplates/admin/space/welcome_space_admin_fr.st
index 7bebca2d0d..72a874502e 100644
--- a/core-configuration/src/main/config/resources/StringTemplates/admin/space/welcome_space_admin_fr.st
+++ b/core-configuration/src/main/config/resources/StringTemplates/admin/space/welcome_space_admin_fr.st
@@ -1,15 +1,20 @@
Bienvenue sur la gestion des espaces et des applications
Willkommen bei der Verwaltung von Bereichen und Anwendungen
-
Silverpeas wird in Bereiche, die Anwendungen enthalten strukturiert. Jeder Bereich kann auch Unterbereiche enthalten.
-Eine breite Palette von gebrauchsfertigen Anwendunge werden angeboten um alle Ihre Bedürfnisse zu erfüllen: Dokumenten-Management, Bildergalerie, Blog, Umfragen, Projektmanagement ...
-Als Bereich Verwalter, können Sie alle Bereiche die Ihnen wichtig sind verwalten.
+
Silverpeas ist in Bereiche unterteilt, die Anwendungen enthalten. Jeder Bereich kann auch Unterbereiche enthalten.
+$if(communityEnabled)$
+Neben den Bereiche ist es möglich, Communities zu erstellen. Dabei handelt es sich um besondere Bereiche, denen die Nutzer selbst beitreten möchten, anstatt dass ihnen ein Administrator den Zugang gewährt.
+
+$endif$
+Es steht Ihnen eine große Auswahl an gebrauchsfertigen Anwendungen zur Verfügung, die all Ihren Anforderungen gerecht werden: Dokumentenverwaltung, Bildergalerie, Blog, Umfragen, Projektverwaltung...
+Als Bereichsverwalter können Sie alle Bereiche, für die Sie zuständig sind, frei verwalten.
-
Es ist sehr einfach, die Struktur Ihres Bereichs zu ändern!
-
Alle First-Level-Bereiche sind über die Dropdown-Liste auf der linken Seite zugänglich. Um eine Bereich zu bearbeiten, löschen oder verwalten, wählen Sie ihn einfach aus dieser Liste aus.
-Der Inhalt des ausgewählten Bereichs wird dann in dieser Liste angezeigt.
-Alle Operationen auf diesem Bereich sind über das Menü Was wollen Sie tun ? erreichbar..
-Sie können insbesondere:
+
Die Struktur Ihres Bereichs zu ändern ist ein Kinderspiel!
+
Alle Bereiche der ersten Ebene sind in der Dropdown-Liste auf der linken Seite zugänglich. Um einen Bereich zu ändern, zu löschen oder zu ergänzen, wählen Sie ihn einfach aus dieser Liste aus.
+Der Inhalt des ausgewählten Bereichs wird dann unter dieser Dropdown-Liste angezeigt.
+Alle für diesen Bereich verfügbaren Vorgänge sind über das Menü Was möchten Sie tun? zugänglich.
+Sie können insbesondere:
-
Anwendungen Hinzufügen, Bearbeiten oder Entfernen,
-
die Zugriffsrechte, die für diese Anwendungen gelten definieren,
-
Verwaltung jedem Benutzer delegieren,
-
eine bestimmte Startseite definieren,
+
Anwendungen hinzufügen, ändern oder löschen,
+
die für diese Anwendungen geltenden Zugriffsrechte festlegen,
+
die Verwaltung an beliebige Benutzer delegieren,
+
eine bestimmte Startseite festlegen,
...
-
Um einen Unterbereich oder eine Anwendung zu verwalten, klicken Sie auf ihren Namen. Es wird Ihnen den Zugriff auf alle mögliche Operationen, über das Menü Was wollen Sie tun ? erlaubt.
+
Um einen Unterbereich oder eine Anwendung zu verwalten, wählen Sie diese aus, um über das Menü Was möchten Sie tun? auf alle Funktionen zuzugreifen.
\ No newline at end of file
diff --git a/core-configuration/src/main/config/resources/StringTemplates/admin/space/welcome_space_manager_en.st b/core-configuration/src/main/config/resources/StringTemplates/admin/space/welcome_space_manager_en.st
index 44d900475f..47d118aa94 100644
--- a/core-configuration/src/main/config/resources/StringTemplates/admin/space/welcome_space_manager_en.st
+++ b/core-configuration/src/main/config/resources/StringTemplates/admin/space/welcome_space_manager_en.st
@@ -1,6 +1,10 @@
Welcome to spaces and applications management
Silverpeas is structured into spaces that contain applications. Each space may also contains sub-spaces.
+$if(communityEnabled)$
+Beside the spaces, it is possible to create communities. Those are peculiar spaces that users themselves request to join, rather than having one administrator grants them access.
+
+$endif$
A wide range of applications ready to use is offered to meet all your needs : document management, image gallery, blog, surveys, project management...
As a space(s) manager, you can manage all the spaces you care.
diff --git a/core-library/src/integration-test/resources/org/silverpeas/core/admin/create-assign-rights-database.sql b/core-library/src/integration-test/resources/org/silverpeas/core/admin/create-assign-rights-database.sql
index 8af87582bb..c3d8a8a7ec 100644
--- a/core-library/src/integration-test/resources/org/silverpeas/core/admin/create-assign-rights-database.sql
+++ b/core-library/src/integration-test/resources/org/silverpeas/core/admin/create-assign-rights-database.sql
@@ -83,6 +83,7 @@ CREATE TABLE IF NOT EXISTS ST_Group
id INT NOT NULL,
domainId INT NOT NULL,
specificId VARCHAR(500) NOT NULL,
+ spaceId VARCHAR(500),
superGroupId INT,
name VARCHAR(100) NOT NULL,
description VARCHAR(400),
@@ -127,6 +128,7 @@ CREATE TABLE IF NOT EXISTS ST_Space
look VARCHAR(50),
displaySpaceFirst SMALLINT,
isPersonal SMALLINT,
+ isCommunity SMALLINT DEFAULT(0) NOT NULL,
CONSTRAINT PK_Space PRIMARY KEY (id),
CONSTRAINT UN_Space_1 UNIQUE(domainFatherId, name),
CONSTRAINT FK_Space_1 FOREIGN KEY (createdBy) REFERENCES ST_User(id),
diff --git a/core-library/src/integration-test/resources/org/silverpeas/core/admin/create_space_components_database.sql b/core-library/src/integration-test/resources/org/silverpeas/core/admin/create_space_components_database.sql
index c16f143e75..e2af720afc 100644
--- a/core-library/src/integration-test/resources/org/silverpeas/core/admin/create_space_components_database.sql
+++ b/core-library/src/integration-test/resources/org/silverpeas/core/admin/create_space_components_database.sql
@@ -58,6 +58,7 @@ CREATE TABLE ST_Group
id int NOT NULL,
domainId int NOT NULL,
specificId varchar(500) NOT NULL,
+ spaceId varchar(500),
superGroupId int,
name varchar(100) NOT NULL,
description varchar(400),
@@ -94,7 +95,8 @@ CREATE TABLE ST_Space
isInheritanceBlocked int default(0) NOT NULL,
look varchar(50),
displaySpaceFirst smallint,
- isPersonal smallint
+ isPersonal smallint,
+ isCommunity SMALLINT DEFAULT(0) NOT NULL
);
CREATE TABLE ST_SpaceI18N
diff --git a/core-library/src/integration-test/resources/org/silverpeas/core/admin/create_space_managers_database.sql b/core-library/src/integration-test/resources/org/silverpeas/core/admin/create_space_managers_database.sql
index a53727ada8..07262fa2f7 100644
--- a/core-library/src/integration-test/resources/org/silverpeas/core/admin/create_space_managers_database.sql
+++ b/core-library/src/integration-test/resources/org/silverpeas/core/admin/create_space_managers_database.sql
@@ -63,6 +63,7 @@ CREATE TABLE ST_Group
domainId int NOT NULL,
specificId varchar(500) NOT NULL,
superGroupId int,
+ spaceId varchar(500),
name varchar(100) NOT NULL,
description varchar(400),
synchroRule varchar(100),
@@ -98,7 +99,8 @@ CREATE TABLE ST_Space
isInheritanceBlocked int default(0) NOT NULL,
look varchar(50),
displaySpaceFirst smallint,
- isPersonal smallint
+ isPersonal smallint,
+ isCommunity SMALLINT DEFAULT(0) NOT NULL
);
CREATE TABLE ST_SpaceI18N
diff --git a/core-library/src/integration-test/resources/org/silverpeas/core/admin/create_table_favorit_space.sql b/core-library/src/integration-test/resources/org/silverpeas/core/admin/create_table_favorit_space.sql
index cca15d8254..59a54a1a41 100644
--- a/core-library/src/integration-test/resources/org/silverpeas/core/admin/create_table_favorit_space.sql
+++ b/core-library/src/integration-test/resources/org/silverpeas/core/admin/create_table_favorit_space.sql
@@ -56,6 +56,7 @@ CREATE TABLE IF NOT EXISTS ST_Space (
look VARCHAR(50),
displaySpaceFirst SMALLINT,
isPersonal SMALLINT,
+ isCommunity SMALLINT DEFAULT(0) NOT NULL,
CONSTRAINT PK_Space PRIMARY KEY (id),
CONSTRAINT UN_Space_1 UNIQUE (domainFatherId, name),
CONSTRAINT FK_Space_1 FOREIGN KEY (createdBy) REFERENCES ST_User (id),
diff --git a/core-library/src/integration-test/resources/org/silverpeas/core/admin/domain/driver/create_table.sql b/core-library/src/integration-test/resources/org/silverpeas/core/admin/domain/driver/create_table.sql
index 61bdc7ca78..3eac95dcb3 100644
--- a/core-library/src/integration-test/resources/org/silverpeas/core/admin/domain/driver/create_table.sql
+++ b/core-library/src/integration-test/resources/org/silverpeas/core/admin/domain/driver/create_table.sql
@@ -50,6 +50,7 @@ CREATE TABLE IF NOT EXISTS ST_Group
id INT NOT NULL,
domainId INT NOT NULL,
specificId VARCHAR(500) NOT NULL,
+ spaceId VARCHAR(500),
superGroupId INT,
name VARCHAR(100) NOT NULL,
description VARCHAR(400),
@@ -94,6 +95,7 @@ CREATE TABLE IF NOT EXISTS ST_Space
look VARCHAR(50),
displaySpaceFirst SMALLINT,
isPersonal SMALLINT,
+ isCommunity SMALLINT DEFAULT(0) NOT NULL,
CONSTRAINT PK_Space PRIMARY KEY (id),
CONSTRAINT UN_Space_1 UNIQUE(domainFatherId, name),
CONSTRAINT FK_Space_1 FOREIGN KEY (createdBy) REFERENCES ST_User(id),
diff --git a/core-library/src/integration-test/resources/org/silverpeas/core/admin/service/create-administration-database.sql b/core-library/src/integration-test/resources/org/silverpeas/core/admin/service/create-administration-database.sql
index 2dde91b116..f9698b0add 100644
--- a/core-library/src/integration-test/resources/org/silverpeas/core/admin/service/create-administration-database.sql
+++ b/core-library/src/integration-test/resources/org/silverpeas/core/admin/service/create-administration-database.sql
@@ -50,6 +50,7 @@ CREATE TABLE ST_Group
id int NOT NULL,
domainId int NOT NULL,
specificId varchar(500) NOT NULL,
+ spaceId VARCHAR(500),
superGroupId int,
name varchar(100) NOT NULL,
description varchar(400),
@@ -98,6 +99,7 @@ CREATE TABLE ST_Space
look VARCHAR(50),
displaySpaceFirst SMALLINT,
isPersonal SMALLINT,
+ isCommunity SMALLINT DEFAULT(0) NOT NULL,
CONSTRAINT PK_Space PRIMARY KEY (id),
CONSTRAINT UN_Space_1 UNIQUE (domainFatherId, name),
CONSTRAINT FK_Space_1 FOREIGN KEY (createdBy) REFERENCES ST_User (id),
diff --git a/core-library/src/integration-test/resources/org/silverpeas/core/admin/user/notification/role/create_database.sql b/core-library/src/integration-test/resources/org/silverpeas/core/admin/user/notification/role/create_database.sql
index 4458503157..c723a0be6a 100644
--- a/core-library/src/integration-test/resources/org/silverpeas/core/admin/user/notification/role/create_database.sql
+++ b/core-library/src/integration-test/resources/org/silverpeas/core/admin/user/notification/role/create_database.sql
@@ -42,6 +42,7 @@ CREATE TABLE ST_Group
id int NOT NULL,
domainId int NOT NULL,
specificId varchar(500) NOT NULL,
+ spaceId VARCHAR(500),
superGroupId int,
name varchar(100) NOT NULL,
description varchar(400),
@@ -86,6 +87,7 @@ CREATE TABLE ST_Space
look VARCHAR(50),
displaySpaceFirst SMALLINT,
isPersonal SMALLINT,
+ isCommunity SMALLINT DEFAULT(0) NOT NULL,
CONSTRAINT PK_Space PRIMARY KEY (id),
CONSTRAINT UN_Space_1 UNIQUE (domainFatherId, name),
CONSTRAINT FK_Space_1 FOREIGN KEY (createdBy) REFERENCES ST_User (id),
diff --git a/core-library/src/integration-test/resources/org/silverpeas/core/calendar/create_table_calendar.sql b/core-library/src/integration-test/resources/org/silverpeas/core/calendar/create_table_calendar.sql
index c33c5995b7..db765e5b18 100644
--- a/core-library/src/integration-test/resources/org/silverpeas/core/calendar/create_table_calendar.sql
+++ b/core-library/src/integration-test/resources/org/silverpeas/core/calendar/create_table_calendar.sql
@@ -20,7 +20,8 @@ CREATE TABLE ST_Space
isInheritanceBlocked int default(0) NOT NULL,
look varchar(50),
displaySpaceFirst smallint,
- isPersonal smallint
+ isPersonal smallint,
+ isCommunity SMALLINT DEFAULT(0) NOT NULL
);
CREATE TABLE IF NOT EXISTS SB_ContentManager_Instance
diff --git a/core-library/src/main/java/org/silverpeas/core/admin/persistence/ComponentInstanceTable.java b/core-library/src/main/java/org/silverpeas/core/admin/persistence/ComponentInstanceTable.java
index af63a1991b..4840be20c0 100644
--- a/core-library/src/main/java/org/silverpeas/core/admin/persistence/ComponentInstanceTable.java
+++ b/core-library/src/main/java/org/silverpeas/core/admin/persistence/ComponentInstanceTable.java
@@ -303,6 +303,7 @@ public void sendComponentToBasket(int id, String tempLabel, String userId)
* @param id the component id
* @throws SQLException on error
*/
+ @SuppressWarnings("DuplicatedCode")
public void restoreComponentFromBasket(int id) throws SQLException {
try (Connection connection = DBUtil.openConnection();
PreparedStatement statement = connection.prepareStatement(RESTORE_COMPONENT_FROM_BASKET)) {
diff --git a/core-library/src/main/java/org/silverpeas/core/admin/persistence/SpaceRow.java b/core-library/src/main/java/org/silverpeas/core/admin/persistence/SpaceRow.java
index 2eebf515ff..a4d1e291c5 100644
--- a/core-library/src/main/java/org/silverpeas/core/admin/persistence/SpaceRow.java
+++ b/core-library/src/main/java/org/silverpeas/core/admin/persistence/SpaceRow.java
@@ -44,4 +44,5 @@ public class SpaceRow {
public String look = null;
public int displaySpaceFirst = -1;
public int isPersonalSpace = -1;
+ public int isCommunitySpace = -1;
}
diff --git a/core-library/src/main/java/org/silverpeas/core/admin/persistence/SpaceTable.java b/core-library/src/main/java/org/silverpeas/core/admin/persistence/SpaceTable.java
index 5bca15b984..986a80d92a 100644
--- a/core-library/src/main/java/org/silverpeas/core/admin/persistence/SpaceTable.java
+++ b/core-library/src/main/java/org/silverpeas/core/admin/persistence/SpaceTable.java
@@ -54,13 +54,13 @@ public class SpaceTable extends Table {
private static final String SPACE_COLUMNS = "id,domainFatherId,name,description,createdBy," +
"firstPageType,firstPageExtraParam,orderNum,createTime,updateTime,removeTime,spaceStatus," +
- "updatedBy,removedBy,lang,isInheritanceBlocked,look,displaySpaceFirst,isPersonal";
+ "updatedBy,removedBy,lang,isInheritanceBlocked,look,displaySpaceFirst,isPersonal,isCommunity";
/**
* Fetch the current space row from a resultSet.
- * @param rs
- * @return
- * @throws SQLException
+ * @param rs the SQL result set.
+ * @return the data of a space in a {@link SpaceRow} instance.
+ * @throws SQLException if an error occurs while fetching the space data.
*/
protected SpaceRow fetchSpace(ResultSet rs) throws SQLException {
SpaceRow s = new SpaceRow();
@@ -113,15 +113,14 @@ protected SpaceRow fetchSpace(ResultSet rs) throws SQLException {
s.isPersonalSpace = 0;
}
+ s.isCommunitySpace = rs.getInt(20);
+ if (rs.wasNull()) {
+ s.isCommunitySpace = 0;
+ }
+
return s;
}
- /**
- * Returns the Space whith the given id.
- * @param id
- * @return
- * @throws SQLException
- */
public SpaceRow getSpace(int id) throws SQLException {
return getUniqueRow(SELECT_SPACE_BY_ID, id);
}
@@ -144,50 +143,25 @@ public SpaceRow getPersonalSpace(String userId) throws SQLException {
private static final String SELECT_PERSONALSPACE =
SELECT + SPACE_COLUMNS + " from ST_Space where isPersonal = ? and createdBy = ? ";
- /**
- * Tests if a space with given space id exists
- * @param id
- * @return true if the given space instance name is an existing space
- * @throws SQLException
- */
- public boolean isSpaceInstExist(int id) throws SQLException {
- return (this.getSpace(id) != null);
- }
-
- /**
- * Returns all the Spaces.
- * @return all the Spaces.
- * @throws SQLException
- */
public SpaceRow[] getAllSpaces() throws SQLException {
List rows = getRows(SELECT_ALL_SPACES);
- return rows.toArray(new SpaceRow[rows.size()]);
+ return rows.toArray(new SpaceRow[0]);
}
private static final String SELECT_ALL_SPACES =
SELECT + SPACE_COLUMNS + " from ST_Space" + " order by orderNum";
- /**
- * Returns all the Space ids.
- * @return all the Space ids.
- * @throws SQLException
- */
public String[] getAllSpaceIds() throws SQLException {
List ids = getIds(SELECT_ALL_SPACE_IDS);
- return ids.toArray(new String[ids.size()]);
+ return ids.toArray(new String[0]);
}
private static final String SELECT_ALL_SPACE_IDS =
"select id from ST_Space" + " order by orderNum";
- /**
- * Returns all the root Space ids.
- * @return all the root Space ids.
- * @throws SQLException
- */
public String[] getAllRootSpaceIds() throws SQLException {
List ids = getIds(SELECT_ALL_ROOT_SPACE_IDS);
- return ids.toArray(new String[ids.size()]);
+ return ids.toArray(new String[0]);
}
private static final String SELECT_ALL_ROOT_SPACE_IDS = "SELECT id FROM st_space WHERE " +
@@ -195,12 +169,12 @@ public String[] getAllRootSpaceIds() throws SQLException {
/**
* Returns all spaces which has been removed but not definitely deleted
- * @return all spaces which has been removed but not definitely deleted
- * @throws SQLException
+ * @return an array with the data of all removed but not deleted spaces.
+ * @throws SQLException if an error occurs while fetching the space data
*/
public SpaceRow[] getRemovedSpaces() throws SQLException {
List rows = getRows(SELECT_REMOVED_SPACES);
- return rows.toArray(new SpaceRow[rows.size()]);
+ return rows.toArray(new SpaceRow[0]);
}
private static final String SELECT_REMOVED_SPACES =
@@ -208,14 +182,14 @@ public SpaceRow[] getRemovedSpaces() throws SQLException {
SpaceInst.STATUS_REMOVED + "'" + " order by removeTime desc";
/**
- * Returns all the space ids having a given superSpace.
- * @param superSpaceId
- * @return all the space ids having a given superSpace.
- * @throws SQLException
+ * Returns all the space ids having a given parent space.
+ * @param superSpaceId the unique identifier of a parent space.
+ * @return all the space ids having the specified parent space.
+ * @throws SQLException if an error occurs while requesting the subspaces identifiers.
*/
public String[] getDirectSubSpaceIds(int superSpaceId) throws SQLException {
List ids = getIds(SELECT_SUBSPACE_IDS, superSpaceId);
- return ids.toArray(new String[ids.size()]);
+ return ids.toArray(new String[0]);
}
private static final String SELECT_SUBSPACE_IDS =
@@ -223,10 +197,10 @@ public String[] getDirectSubSpaceIds(int superSpaceId) throws SQLException {
"and spaceStatus is null order by orderNum";
/**
- * Returns direct sub spaces of given space.
- * @param superSpaceId
+ * Returns yjr direct sub spaces of the given space.
+ * @param superSpaceId the unique identifier of a space.
* @return all direct sub spaces of given space.
- * @throws SQLException
+ * @throws SQLException if an error occurs while fetching the subspaces.
*/
public List getDirectSubSpaces(int superSpaceId) throws SQLException {
return getRows(SELECT_SUBSPACES, superSpaceId);
@@ -236,11 +210,6 @@ public List getDirectSubSpaces(int superSpaceId) throws SQLException {
SELECT + SPACE_COLUMNS + " from ST_Space where domainFatherId = ? " +
"and spaceStatus is null order by orderNum";
- /**
- * Inserts in the database a new space row.
- * @param space
- * @throws SQLException
- */
public void createSpace(SpaceRow space) throws SQLException {
SpaceRow superSpace;
@@ -255,7 +224,7 @@ public void createSpace(SpaceRow space) throws SQLException {
}
private static final String INSERT_SPACE = "insert into" + " ST_Space(" + SPACE_COLUMNS + ")" +
- " values (? ,? ,? ,? ,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+ " values (? ,? ,? ,? ,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
@Override
protected void prepareInsert(String insertQuery, PreparedStatement insert, SpaceRow row)
@@ -307,6 +276,8 @@ protected void prepareInsert(String insertQuery, PreparedStatement insert, Space
} else {
insert.setNull(19, Types.SMALLINT);
}
+
+ insert.setInt(20, row.isCommunitySpace);
}
public void updateSpaceOrder(int spaceId, int orderNum) throws SQLException {
@@ -317,11 +288,6 @@ public void updateSpaceOrder(int spaceId, int orderNum) throws SQLException {
private static final String UPDATE_SPACE_ORDER =
"update ST_Space set" + " orderNum = ? where id = ?";
- /**
- * Updates a space row.
- * @param space
- * @throws SQLException
- */
public void updateSpace(SpaceRow space) throws SQLException {
updateRow(UPDATE_SPACE, space);
}
@@ -331,10 +297,10 @@ public void updateSpace(SpaceRow space) throws SQLException {
" createdBy = ?," + " firstPageType = ?," + " firstPageExtraParam = ?," +
" orderNum = ?, updateTime = ?," + " updatedBy = ?," + " spaceStatus = ?, lang = ?," +
" isInheritanceBlocked = ?," + " look = ?," + " displaySpaceFirst = ?," +
- " isPersonal = ? " + " where id = ?";
+ " isPersonal = ?, isCommunity = ? " + " where id = ?";
@Override
- protected void prepareUpdate(String updateQuery, PreparedStatement update, SpaceRow row)
+ protected void prepareUpdate(String updateQuery, PreparedStatement update, SpaceRow row)
throws SQLException {
if (row.domainFatherId == 0) {
@@ -371,7 +337,9 @@ protected void prepareUpdate(String updateQuery, PreparedStatement update, Space
update.setNull(15, Types.SMALLINT);
}
- update.setInt(16, row.id);
+ update.setInt(16, row.isCommunitySpace);
+
+ update.setInt(17, row.id);
}
public void moveSpace(int spaceId, int fatherId) throws SQLException {
@@ -383,11 +351,6 @@ public void moveSpace(int spaceId, int fatherId) throws SQLException {
private static final String MOVE_SPACE = "update ST_SPACE set domainFatherId = ? where id = ?";
- /**
- * Delete the space and all his component instances.
- * @param id
- * @throws SQLException
- */
public void removeSpace(int id) throws SQLException {
SpaceRow space = getSpace(id);
if (space == null) {
@@ -410,11 +373,12 @@ public void removeSpace(int id) throws SQLException {
private static final String DELETE_SPACE = "delete from ST_Space where id = ?";
/**
- * Delete the space and all his component instances.
- * @param id
- * @param newName
- * @param userId
- * @throws SQLException
+ * Removes the specified space and all its component instances. The space and its component
+ * instances are placed into the basket.
+ * @param id the unique identifier of a space
+ * @param newName the new name of the space once in the basket
+ * @param userId the unique identifier of the user performing the task.
+ * @throws SQLException if an SQL error occurs.
*/
public void sendSpaceToBasket(int id, String newName, String userId)
throws SQLException {
@@ -433,10 +397,10 @@ public void sendSpaceToBasket(int id, String newName, String userId)
"update ST_Space set name = ?, removedBy = ?, removeTime = ?, spaceStatus = ? where id = ?";
/**
- * Check if a named space already exists in given space
- * @param fatherId
- * @param name
- * @throws SQLException
+ * Check if a named space already exists in the given space in the basket.
+ * @param fatherId the unique identifier of a parent space in the basket.
+ * @param name the name of a subspace.
+ * @throws SQLException if an SQL error occurs.
*/
public boolean isSpaceIntoBasket(int fatherId, String name) throws SQLException {
try (Connection connection = DBUtil.openConnection();
@@ -454,10 +418,11 @@ public boolean isSpaceIntoBasket(int fatherId, String name) throws SQLException
"select * from ST_Space where name = ? and domainFatherId = ? and spaceStatus = ? ";
/**
- * Remove the space from the basket Space will be available again
- * @param id
- * @throws SQLException
+ * Remove the space from the basket.
+ * @param id the unique identifier of the space.
+ * @throws SQLException if an SQL error occurs.
*/
+ @SuppressWarnings("DuplicatedCode")
public void removeSpaceFromBasket(int id) throws SQLException {
try (Connection connection = DBUtil.openConnection();
PreparedStatement statement = connection.prepareStatement(REMOVE_SPACE_FROM_BASKET)) {
@@ -472,20 +437,6 @@ public void removeSpaceFromBasket(int id) throws SQLException {
private static final String REMOVE_SPACE_FROM_BASKET =
"update ST_Space set removedBy = ?, removeTime = ?, spaceStatus = ? where id = ?";
- /**
- * Returns the Space of a given space user role.
- * @param spaceUserRoleId
- * @return the Space of a given space user role.
- * @throws SQLException
- */
- public SpaceRow getSpaceOfSpaceUserRole(int spaceUserRoleId) throws SQLException {
- return getUniqueRow(SELECT_SPACEUSERROLE_SPACE, spaceUserRoleId);
- }
-
- private static final String SELECT_SPACEUSERROLE_SPACE =
- SELECT + aliasColumns("i", SPACE_COLUMNS) + " from ST_Space i, ST_SpaceUserRole us" +
- " where i.id = us.spaceId and us.id = ?";
-
/**
* Fetch the current space row from a resultSet.
*/
diff --git a/core-library/src/main/java/org/silverpeas/core/admin/service/AdminController.java b/core-library/src/main/java/org/silverpeas/core/admin/service/AdminController.java
index dd66fc4cdb..42621330d7 100644
--- a/core-library/src/main/java/org/silverpeas/core/admin/service/AdminController.java
+++ b/core-library/src/main/java/org/silverpeas/core/admin/service/AdminController.java
@@ -701,7 +701,6 @@ public long getDomainActions(String domainId) {
* Get ALL the domain's groups
*/
public GroupDetail[] getRootGroupsOfDomain(String domainId) {
-
try {
return admin.getRootGroupsOfDomain(domainId);
} catch (Exception e) {
diff --git a/core-library/src/main/java/org/silverpeas/core/admin/service/Administration.java b/core-library/src/main/java/org/silverpeas/core/admin/service/Administration.java
index 8dde1714f8..40816889ad 100644
--- a/core-library/src/main/java/org/silverpeas/core/admin/service/Administration.java
+++ b/core-library/src/main/java/org/silverpeas/core/admin/service/Administration.java
@@ -35,10 +35,10 @@
import org.silverpeas.core.admin.space.SpaceProfileInst;
import org.silverpeas.core.admin.user.constant.GroupState;
import org.silverpeas.core.admin.user.model.*;
-import org.silverpeas.kernel.annotation.NonNull;
-import org.silverpeas.kernel.util.Pair;
import org.silverpeas.core.util.ServiceProvider;
import org.silverpeas.core.util.SilverpeasList;
+import org.silverpeas.kernel.annotation.NonNull;
+import org.silverpeas.kernel.util.Pair;
import java.util.Collection;
import java.util.List;
@@ -497,7 +497,8 @@ String updateSpaceProfileInst(SpaceProfileInst newSpaceProfile, String userId)
GroupDetail[] getGroups(String[] asGroupId) throws AdminException;
/**
- * Add the given group in Silverpeas.
+ * Add the given group in Silverpeas and in the domain related by the specified group. The domain
+ * to which the group belongs must be set ({@link Group#getDomainId()}
*
* @param group a user group.
* @return the identifier of the new group.
@@ -506,10 +507,12 @@ String updateSpaceProfileInst(SpaceProfileInst newSpaceProfile, String userId)
String addGroup(GroupDetail group) throws AdminException;
/**
- * Add the given group in Silverpeas.
+ * Add the given group in Silverpeas. If the group has to be added also in a user domain, this one
+ * has to be specified by the group ({@link Group#getDomainId()}.
*
* @param group a user group.
- * @param onlyInSilverpeas performs the operation only in Silverpeas
+ * @param onlyInSilverpeas performs the operation only in Silverpeas. Otherwise it will be done
+ * also in the domain specified by the given group.
* @return the identifier of the new group
* @throws AdminException if an error occurs
*/
@@ -1520,12 +1523,38 @@ List getSpecificPropertiesToImportUsers(String domainId, String
List searchUserIdsByProfile(final List profileIds,
final boolean includeRemovedUsersAndGroups) throws AdminException;
+ /**
+ * Search all the users matching the specified criteria.
+ * @param searchCriteria the criteria the users have to satisfy.
+ * @return a possible paginated list of users.
+ * @throws AdminException if the users cannot be fetched according to the specified criteria.
+ */
SilverpeasList searchUsers(UserDetailsSearchCriteria searchCriteria)
throws AdminException;
+ /**
+ * Search all the user groups matching the specified criteria. No ordering is done in the
+ * returned list of user groups.
+ * @param searchCriteria the criteria the groups have to satisfy.
+ * @return a possible paginated list of user groups.
+ * @throws AdminException if the groups cannot be fetched according to the specified criteria.
+ */
SilverpeasList searchGroups(GroupsSearchCriteria searchCriteria)
throws AdminException;
+ /**
+ * Search all the user groups matching the specified criteria and order or not the list by
+ * their type. If ordered by their type, then the first groups will be the usual ones and the
+ * last ones will the the community groups.
+ * @param searchCriteria the criteria the groups have to satisfy.
+ * @param orderedByType a flag indicating if the returned groups have to be ordered by their
+ * type.
+ * @return a possible paginated list of user groups.
+ * @throws AdminException if the groups cannot be fetched according to the specified criteria.
+ */
+ SilverpeasList searchGroups(GroupsSearchCriteria searchCriteria,
+ boolean orderedByType) throws AdminException;
+
// -------------------------------------------------------------------------
// Node profile management
// -------------------------------------------------------------------------
diff --git a/core-library/src/main/java/org/silverpeas/core/admin/service/CommunityFactory.java b/core-library/src/main/java/org/silverpeas/core/admin/service/CommunityFactory.java
new file mode 100644
index 0000000000..cb4cb40488
--- /dev/null
+++ b/core-library/src/main/java/org/silverpeas/core/admin/service/CommunityFactory.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2000 - 2025 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:
+ * "https://www.silverpeas.org/legal/floss_exception.html"
+ *
+ * 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 .
+ */
+
+package org.silverpeas.core.admin.service;
+
+import org.silverpeas.core.admin.component.model.ComponentInst;
+import org.silverpeas.core.admin.space.SpaceInst;
+import org.silverpeas.kernel.annotation.NonNull;
+
+/**
+ * Factory of a community of users. This interface is used by Silverpeas to bootstrap a community
+ * when an administrator creates a community space. The community space is just an usual space and
+ * in order to be a community one, a community has to be created and then linked to the space. This
+ * factory aims to create such community for a given space in Silverpeas.
+ *
+ * Silverpeas supports two kinds of spaces: collaborative spaces and community spaces. Latter are
+ * only available if an application dedicated to manage the memberships of a community is available.
+ * Otherwise, the communities support is disabled and only collaborative spaces are available. The
+ * constrain for such application is to provide an implementation of this interface, and that has to
+ * be available in the underlying IoC subsystem.
+ *
+ *
+ * @author mmoquillon
+ */
+public interface CommunityFactory {
+
+ /**
+ * Creates a community for the specified Silverpeas space. This will spawn the membership
+ * management application for the the specified Silverpeas space.
+ *
+ * @param communitySpace a Silverpeas space.
+ * @return the component instance representing the application dedicated to manage the
+ * created community membership.
+ * @throws org.silverpeas.kernel.SilverpeasRuntimeException if the community cannot be created.
+ */
+ @NonNull
+ ComponentInst createCommunity(@NonNull SpaceInst communitySpace);
+
+}
diff --git a/core-library/src/main/java/org/silverpeas/core/admin/service/CommunityMembersGroup.java b/core-library/src/main/java/org/silverpeas/core/admin/service/CommunityMembersGroup.java
new file mode 100644
index 0000000000..b157a87bae
--- /dev/null
+++ b/core-library/src/main/java/org/silverpeas/core/admin/service/CommunityMembersGroup.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2000 - 2025 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:
+ * "https://www.silverpeas.org/legal/floss_exception.html"
+ *
+ * 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 .
+ */
+
+package org.silverpeas.core.admin.service;
+
+import org.silverpeas.core.admin.domain.model.Domain;
+import org.silverpeas.core.admin.user.model.GroupDetail;
+import org.silverpeas.kernel.util.StringUtil;
+
+/**
+ * A group of a community members. Such groups are managed directly by the community to which they
+ * belong and as such they don't belong to a user domain (they are defined in the mixed domain). The
+ * life-cycle of these groups are then taken in charge by the application in charge of the members
+ * of a community space and not by the Silverpeas administrative services. They are intended to to
+ * ease the use of groups of users for the applications in charge of a community.
+ *
+ * @author mmoquillon
+ */
+public class CommunityMembersGroup extends GroupDetail {
+
+ /**
+ * Constructs a new community members group with the given name and for the specified community
+ * space.
+ *
+ * @param name the name of the user group.
+ * @param spaceId the unique identifier of the Silverpeas space for which this group is
+ * created.
+ */
+ public CommunityMembersGroup(String name, String spaceId) {
+ super();
+ setName(name);
+ setRule(null);
+ setDomainId(Domain.MIXED_DOMAIN_ID);
+ if (StringUtil.isNotDefined(spaceId)) {
+ throw new IllegalArgumentException("The identifier of the community space should be set");
+ }
+ setSpaceId(spaceId);
+ }
+
+ public CommunityMembersGroup(GroupDetail groupDetail) {
+ super(groupDetail);
+ if (!groupDetail.isCommunityGroup()) {
+ throw new IllegalArgumentException(
+ "The specified group isn't a group managed by an application");
+ }
+ setTotalNbUsers(groupDetail.getTotalUsersCount());
+ setRule(null);
+ setDomainId(Domain.MIXED_DOMAIN_ID);
+ }
+
+ @Override
+ public boolean isCommunityGroup() {
+ return true;
+ }
+
+ @Override
+ public boolean isSynchronized() {
+ return false;
+ }
+
+ @Override
+ public void setDomainId(String newDomainId) {
+ if (!newDomainId.equals(Domain.MIXED_DOMAIN_ID)) {
+ throw new IllegalArgumentException("An application managed group can belong only to the " +
+ "mixed user domain");
+ }
+ super.setDomainId(newDomainId);
+ }
+
+ /**
+ * The synchronization isn't supported by the application managed groups. So, this method does
+ * nothing.
+ *
+ * @param rule the synchronization rule to set.
+ */
+ @Override
+ public void setRule(String rule) {
+ // not supported by this Group implementation
+ }
+
+
+}
+
\ No newline at end of file
diff --git a/core-library/src/main/java/org/silverpeas/core/admin/service/CommunityMembershipService.java b/core-library/src/main/java/org/silverpeas/core/admin/service/CommunityMembershipService.java
new file mode 100644
index 0000000000..4bc351710c
--- /dev/null
+++ b/core-library/src/main/java/org/silverpeas/core/admin/service/CommunityMembershipService.java
@@ -0,0 +1,245 @@
+/*
+ * Copyright (C) 2000 - 2025 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:
+ * "https://www.silverpeas.org/legal/floss_exception.html"
+ *
+ * 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 .
+ */
+
+package org.silverpeas.core.admin.service;
+
+import org.silverpeas.core.admin.space.SpaceInst;
+import org.silverpeas.core.admin.space.SpaceProfileInst;
+import org.silverpeas.core.admin.user.model.Group;
+import org.silverpeas.core.admin.user.model.GroupDetail;
+import org.silverpeas.core.admin.user.model.SilverpeasRole;
+import org.silverpeas.core.admin.user.model.User;
+import org.silverpeas.core.annotation.Service;
+import org.silverpeas.core.util.ServiceProvider;
+import org.silverpeas.kernel.SilverpeasRuntimeException;
+
+import javax.ejb.Singleton;
+import javax.inject.Inject;
+import javax.transaction.Transactional;
+import java.util.List;
+import java.util.stream.Stream;
+
+import static java.util.function.Predicate.not;
+
+/**
+ * A service to ease the management of the members of a community for the applications that are in
+ * charge of the community membership. This is for those applications of having to use explicitly
+ * the {@link org.silverpeas.core.admin.service.Administration} service for doing.
+ *
+ * @author mmoquillon
+ */
+@Service
+@Singleton
+@Transactional(Transactional.TxType.MANDATORY)
+public class CommunityMembershipService {
+
+ @Inject
+ private Administration admin;
+
+ /**
+ * Gets an instance of a {@link CommunityMembershipService}.
+ *
+ * @return an {@link CommunityMembershipService} instance.
+ */
+ public static CommunityMembershipService get() {
+ return ServiceProvider.getService(CommunityMembershipService.class);
+ }
+
+ /**
+ * Gets the community identified by the specified community space unique identifier.
+ *
+ * @param spaceId the unique identifier of a community space.
+ * @return a {@link SpaceInst} instance that represents the asked community.
+ * @throws AdminException if the community space cannot be found.
+ */
+ public SpaceInst getCommunity(String spaceId) throws AdminException {
+ SpaceInst space = admin.getSpaceInstById(spaceId);
+ if (space == null || !space.isCommunitySpace()) {
+ throw new AdminException("No community space found with id " + spaceId);
+ }
+ return space;
+ }
+
+ /**
+ * Gets the community members group identified by the specified identifier. If no such group
+ * exists, null is returned. If the group isn't a community one, an
+ * {@link IllegalArgumentException} is thrown.
+ *
+ * @param groupId the unique identifier of a user group
+ * @return an application managed user group.
+ * @throws AdminException if an error occurs while fetching the asked user group
+ * @throws IllegalArgumentException if the asked group isn't managed by a Silverpeas application.
+ */
+ public CommunityMembersGroup getGroup(String groupId) throws AdminException {
+ return asAppManagedGroupDetail(admin.getGroup(groupId));
+ }
+
+ /**
+ * Saves any changes in the specified user group in the datasource.
+ *
+ * @param group the user group.
+ * @throws AdminException if the update fails.
+ */
+ public void updateGroup(CommunityMembersGroup group) throws AdminException {
+ admin.updateGroup(group, true);
+ }
+
+ /**
+ * Adds the specified user as a member of the community represented by the specified members group
+ * and with the specified role to play in the community.
+ *
+ * @param user the user to add among the members of a community.
+ * @param group the group of members associated with the community space.
+ * @param role the role the user has to play in the community space.
+ * @throws AdminException if an error occurs while putting the user as a member of the community
+ * space.
+ */
+ public void addMember(User user, CommunityMembersGroup group, SilverpeasRole role)
+ throws AdminException {
+ User currentUser = User.getCurrentRequester();
+ var space = admin.getSpaceInstById(group.getSpaceId());
+ var profile = getSpaceProfile(currentUser, role, space);
+ if (!isUserHasProfile(user, profile)) {
+ profile.addUser(user.getId());
+ admin.updateSpaceProfileInst(profile, currentUser.getId());
+ }
+ if (!isUserInGroup(user, group)) {
+ admin.addUserInGroup(user.getId(), group.getId());
+ }
+ }
+
+ /**
+ * Removes the specified user from the members of the community represented by the specified
+ * members group. The consequence is the user isn't anymore a member of the community space
+ * related by the given group.
+ *
+ * @param user the user to remove from the community.
+ * @param group the group of members of the community.
+ * @throws AdminException if an error occurs while removing the user from the community.
+ */
+ public void removeMember(User user, CommunityMembersGroup group) throws AdminException {
+ var space = admin.getSpaceInstById(group.getSpaceId());
+ removeUserFromAllSpaceProfiles(user, space);
+ if (isUserInGroup(user, group)) {
+ admin.removeUserFromGroup(user.getId(), group.getId());
+ }
+ }
+
+ /**
+ * Setups the community in Silverpeas for the specified community space. The given space has to
+ * be a community one, otherwise an {@link IllegalArgumentException} will be thrown. A group of
+ * members of the specified community will be created with, optionally, the given symbol as a
+ * prefix of the group name.
+ *
+ * @param spaceId the unique identifier of a community space.
+ * @param symbol a symbol to prepend to the name of the members group in order to distinguish it.
+ * @return the group with which the community members can be handled.
+ * @throws AdminException if the creation fails.
+ */
+ public CommunityMembersGroup setUpCommunity(String spaceId, String symbol) throws AdminException {
+ var currentUser = User.getCurrentRequester();
+ var space = getCommunity(spaceId);
+ var group = new CommunityMembersGroup(symbol + " " + space.getName(), spaceId);
+ String groupId = admin.addGroup(group, true);
+ var profile = getSpaceProfile(currentUser, SilverpeasRole.READER, space);
+ profile.addGroup(groupId);
+ admin.updateSpaceProfileInst(profile, currentUser.getId());
+ return asAppManagedGroupDetail(admin.getGroup(groupId));
+ }
+
+ /**
+ * Deletes the community in Silverpeas related by the specified members group. The community
+ * space related by the group is identified with the {@link CommunityMembersGroup#getSpaceId()}
+ * property. The Silverpeas space that backed the community will be then a regular
+ * collaborative space the and the group of the community members will be deleted.
+ *
+ * @param spaceId the unique identifier of a community space
+ * @param groupId the unique identifier of the group with the members of the community.
+ * @throws AdminException if the community attached to the underlying Silverpeas space cannot
+ * be deleted.
+ */
+ public void deleteCommunity(String spaceId, String groupId) throws AdminException {
+ if (spaceId != null) {
+ var space = admin.getSpaceInstById(spaceId);
+ if (space != null) {
+ space.setCommunitySpace(false);
+ admin.updateSpaceInst(space);
+ }
+ }
+
+ if (groupId != null) {
+ Group group = admin.getGroup(groupId);
+ if (group != null && group.isCommunityGroup()) {
+ admin.deleteGroupById(group.getId(), true);
+ }
+ }
+ }
+
+ private void removeUserFromAllSpaceProfiles(User user, SpaceInst space) {
+ User currentUser = User.getCurrentRequester();
+ streamOnNonInheritedSpaceProfiles(space)
+ .filter(p -> isUserHasProfile(user, p))
+ .forEach(p -> {
+ try {
+ p.removeUser(user.getId());
+ admin.updateSpaceProfileInst(p, currentUser.getId());
+ } catch (Exception e) {
+ throw new SilverpeasRuntimeException(e);
+ }
+ });
+ }
+
+ private Stream streamOnNonInheritedSpaceProfiles(SpaceInst space) {
+ return space.getAllSpaceProfilesInst().stream()
+ .filter(not(SpaceProfileInst::isManager).and(not(SpaceProfileInst::isInherited)));
+ }
+
+ private CommunityMembersGroup asAppManagedGroupDetail(GroupDetail groupDetail) {
+ return groupDetail == null ? null : new CommunityMembersGroup(groupDetail);
+ }
+
+ private SpaceProfileInst getSpaceProfile(User invoker, SilverpeasRole role, SpaceInst space)
+ throws AdminException {
+
+ var profile = space.getDirectSpaceProfileInst(role.getName());
+ if (profile == null) {
+ profile = new SpaceProfileInst();
+ profile.setName(role.getName());
+ profile.setSpaceFatherId(space.getId());
+ profile.setInherited(false);
+ admin.addSpaceProfileInst(profile, invoker.getId());
+ space.addSpaceProfileInst(profile);
+ }
+ return profile;
+ }
+
+ private boolean isUserHasProfile(User user, SpaceProfileInst profile) {
+ return profile.getAllUsers().contains(user.getId());
+ }
+
+ private boolean isUserInGroup(User user, GroupDetail group) {
+ return List.of(group.getUserIds()).contains(user.getId());
+ }
+}
+
\ No newline at end of file
diff --git a/core-library/src/main/java/org/silverpeas/core/admin/service/DefaultAdministration.java b/core-library/src/main/java/org/silverpeas/core/admin/service/DefaultAdministration.java
index a4846f19d1..f66d387285 100644
--- a/core-library/src/main/java/org/silverpeas/core/admin/service/DefaultAdministration.java
+++ b/core-library/src/main/java/org/silverpeas/core/admin/service/DefaultAdministration.java
@@ -5343,9 +5343,15 @@ private void addAllUsersInProfile(final ProfileInst aProfile, final Collection searchGroups(final GroupsSearchCriteria searchCriteria)
throws AdminException {
+ return searchGroups(searchCriteria, false);
+ }
+
+ @Override
+ public SilverpeasList searchGroups(GroupsSearchCriteria searchCriteria,
+ boolean orderedByType) throws AdminException {
searchCriteriaVisitors.forEach(searchCriteria::accept);
return searchCriteria.isEmpty() ?
- ListSlice.emptyList() : groupManager.getGroupsMatchingCriteria(searchCriteria);
+ ListSlice.emptyList() : groupManager.getGroupsMatchingCriteria(searchCriteria, orderedByType);
}
// -------------------------------------------------------------------------
diff --git a/core-library/src/main/java/org/silverpeas/core/admin/service/DefaultOrganizationController.java b/core-library/src/main/java/org/silverpeas/core/admin/service/DefaultOrganizationController.java
index 4f9eb67468..4c11190c4f 100644
--- a/core-library/src/main/java/org/silverpeas/core/admin/service/DefaultOrganizationController.java
+++ b/core-library/src/main/java/org/silverpeas/core/admin/service/DefaultOrganizationController.java
@@ -375,9 +375,10 @@ public UserDetail[] getFilteredDirectUsers(String sGroupId, String sUserLastName
@SuppressWarnings("unchecked")
@Override
- public SilverpeasList searchGroups(final GroupsSearchCriteria criteria) {
+ public SilverpeasList searchGroups(final GroupsSearchCriteria criteria,
+ boolean orderedByType) {
try {
- return (SilverpeasList) getAdminService().searchGroups(criteria);
+ return (SilverpeasList) getAdminService().searchGroups(criteria, orderedByType);
} catch (AdminException e) {
SilverLogger.getLogger(this).error(e.getMessage(), e);
}
diff --git a/core-library/src/main/java/org/silverpeas/core/admin/service/OrganizationController.java b/core-library/src/main/java/org/silverpeas/core/admin/service/OrganizationController.java
index 5282b82991..d8dcfa6291 100644
--- a/core-library/src/main/java/org/silverpeas/core/admin/service/OrganizationController.java
+++ b/core-library/src/main/java/org/silverpeas/core/admin/service/OrganizationController.java
@@ -240,11 +240,15 @@ Map> getParameterValuesByComponentIdThenByParamName(
/**
* Searches the groups that match the specified criteria.
+ *
* @param criteria the criteria in searching of user groups.
+ * @param orderedByType are the returned groups have to be ordered by their type? If yes, then
+ * first are the usual groups and then the community ones.
* @return a slice of the list of user groups matching the criteria or an empty list of no ones
- * are found. user groups.
+ * are found.
*/
- SilverpeasList searchGroups(GroupsSearchCriteria criteria);
+ SilverpeasList searchGroups(GroupsSearchCriteria criteria,
+ boolean orderedByType);
/**
* Returns the total number of distinct users recursively contained in the specified group
diff --git a/core-library/src/main/java/org/silverpeas/core/admin/service/SpaceInstManager.java b/core-library/src/main/java/org/silverpeas/core/admin/service/SpaceInstManager.java
index 3a225f9fde..0c890bac5f 100644
--- a/core-library/src/main/java/org/silverpeas/core/admin/service/SpaceInstManager.java
+++ b/core-library/src/main/java/org/silverpeas/core/admin/service/SpaceInstManager.java
@@ -105,6 +105,7 @@ public SpaceInst copy(SpaceInst spaceInstToCopy) {
spaceInst.setRemoverUserId(spaceInstToCopy.getRemoverUserId());
spaceInst.setInheritanceBlocked(spaceInstToCopy.isInheritanceBlocked());
spaceInst.setLook(spaceInstToCopy.getLook());
+ spaceInst.setCommunitySpace(spaceInstToCopy.isCommunitySpace());
// Copy data
spaceInst.copyDataFrom(spaceInstToCopy);
@@ -293,6 +294,7 @@ private SpaceInst spaceRow2SpaceInst(SpaceRow space) {
spaceInst.setDisplaySpaceFirst(space.displaySpaceFirst == 1);
spaceInst.setPersonalSpace(space.isPersonalSpace == 1);
+ spaceInst.setCommunitySpace(space.isCommunitySpace == 1);
return spaceInst;
}
@@ -645,23 +647,10 @@ private SpaceRow makeSpaceRow(SpaceInst spaceInst) {
space.updatedBy = idAsInt(spaceInst.getUpdaterUserId());
space.lang = spaceInst.getLanguage();
space.look = spaceInst.getLook();
-
- if (spaceInst.isInheritanceBlocked()) {
- space.inheritanceBlocked = 1;
- } else {
- space.inheritanceBlocked = 0;
- }
-
- if (spaceInst.isDisplaySpaceFirst()) {
- space.displaySpaceFirst = 1;
- } else {
- space.displaySpaceFirst = 0;
- }
-
- space.isPersonalSpace = 0;
- if (spaceInst.isPersonalSpace()) {
- space.isPersonalSpace = 1;
- }
+ space.inheritanceBlocked = spaceInst.isInheritanceBlocked() ? 1 : 0;
+ space.displaySpaceFirst = spaceInst.isDisplaySpaceFirst() ? 1 : 0;
+ space.isPersonalSpace = spaceInst.isPersonalSpace() ? 1 : 0;
+ space.isCommunitySpace = spaceInst.isCommunitySpace() ? 1 : 0;
return space;
}
diff --git a/core-library/src/main/java/org/silverpeas/core/admin/space/SpaceInst.java b/core-library/src/main/java/org/silverpeas/core/admin/space/SpaceInst.java
index f5d909362f..bbcf118180 100644
--- a/core-library/src/main/java/org/silverpeas/core/admin/space/SpaceInst.java
+++ b/core-library/src/main/java/org/silverpeas/core/admin/space/SpaceInst.java
@@ -120,6 +120,7 @@ public class SpaceInst extends AbstractI18NBean
private int level;
private boolean displaySpaceFirst;
private boolean isPersonalSpace;
+ private boolean isCommunitySpace;
@Override
protected Class getTranslationType() {
@@ -590,6 +591,14 @@ public boolean isPersonalSpace() {
return isPersonalSpace;
}
+ public boolean isCommunitySpace() {
+ return isCommunitySpace;
+ }
+
+ public void setCommunitySpace(boolean communitySpace) {
+ isCommunitySpace = communitySpace;
+ }
+
/**
* @return the componentSpaceQuota
*/
diff --git a/core-library/src/main/java/org/silverpeas/core/admin/user/GroupManager.java b/core-library/src/main/java/org/silverpeas/core/admin/user/GroupManager.java
index 2f098b2bf4..635152d18e 100644
--- a/core-library/src/main/java/org/silverpeas/core/admin/user/GroupManager.java
+++ b/core-library/src/main/java/org/silverpeas/core/admin/user/GroupManager.java
@@ -23,17 +23,10 @@
*/
package org.silverpeas.core.admin.user;
-import org.silverpeas.kernel.SilverpeasRuntimeException;
import org.silverpeas.core.admin.PaginationPage;
import org.silverpeas.core.admin.domain.DomainDriverManager;
import org.silverpeas.core.admin.domain.synchro.SynchroDomainReport;
-import org.silverpeas.core.admin.persistence.GroupUserRoleRow;
-import org.silverpeas.core.admin.persistence.GroupUserRoleTable;
-import org.silverpeas.core.admin.persistence.OrganizationSchema;
-import org.silverpeas.core.admin.persistence.SpaceUserRoleRow;
-import org.silverpeas.core.admin.persistence.SpaceUserRoleTable;
-import org.silverpeas.core.admin.persistence.UserRoleRow;
-import org.silverpeas.core.admin.persistence.UserRoleTable;
+import org.silverpeas.core.admin.persistence.*;
import org.silverpeas.core.admin.service.AdminException;
import org.silverpeas.core.admin.service.GroupAlreadyExistsAdminException;
import org.silverpeas.core.admin.user.constant.GroupState;
@@ -51,6 +44,7 @@
import org.silverpeas.core.persistence.jdbc.DBUtil;
import org.silverpeas.core.util.ServiceProvider;
import org.silverpeas.core.util.SilverpeasList;
+import org.silverpeas.kernel.SilverpeasRuntimeException;
import org.silverpeas.kernel.util.StringUtil;
import javax.inject.Inject;
@@ -109,15 +103,19 @@ public static GroupManager get() {
/**
* Gets the {@link GroupState#VALID} groups that match the specified criteria.
*
- * @param criteria the criteria in searching of user groups.
+ * @param criteria the criteria the user groups have to satisfy.
+ * @param orderedByType flag indicating if the groups in the returned list have to be ordered
+ * by their type. If true, then the list will have first the usual groups and then the
+ * community ones.
* @return a slice of the list of user groups matching the criteria or an empty list of no ones
* are found.
* @throws AdminException if an error occurs while getting the user groups.
*/
- public SilverpeasList getGroupsMatchingCriteria(final GroupsSearchCriteria criteria)
- throws AdminException {
+ public SilverpeasList getGroupsMatchingCriteria(final GroupsSearchCriteria criteria,
+ boolean orderedByType) throws AdminException {
try (Connection connection = DBUtil.openConnection()) {
- final GroupCriteriaFilter filter = new GroupCriteriaFilter(connection, criteria, groupDao);
+ final GroupCriteriaFilter filter = new GroupCriteriaFilter(connection, criteria,
+ orderedByType, groupDao);
final SilverpeasList groups = filter.getFilteredValidGroups();
String[] domainIdConstraint = new String[0];
if (criteria.isCriterionOnDomainIdSet()) {
@@ -1054,13 +1052,15 @@ private static class GroupCriteriaFilter {
private final boolean childrenRequired;
private final boolean mustMatchAllRoles;
private final boolean logicalNameFiltering;
+ private final boolean orderedByType;
private final Map> subGroupsOfGroupsCache = new LinkedHashMap<>();
GroupCriteriaFilter(final Connection connection, final GroupsSearchCriteria criteria,
- final GroupDAO groupDao) {
+ final boolean orderedByType, final GroupDAO groupDao) {
this.connection = connection;
this.criteria = criteria;
this.groupDao = groupDao;
+ this.orderedByType = orderedByType;
this.nameFilter = defaultStringIfNotDefined(criteria.getCriterionOnName()).replace('*', '%');
this.childrenRequired = criteria.childrenRequired();
this.logicalNameFiltering = childrenRequired && isDefined(nameFilter);
@@ -1077,7 +1077,7 @@ private static class GroupCriteriaFilter {
}
SilverpeasList getFilteredValidGroups() throws SQLException {
- List groups = groupDao.getGroupsByCriteria(connection, criteria);
+ List groups = groupDao.getGroupsByCriteria(connection, criteria, orderedByType);
final Map> rolesByGroup = getRolesByGroup(groups);
groups = addChildrenAndFilterOnName(groups, rolesByGroup);
matchingAllRoles(groups, rolesByGroup);
diff --git a/core-library/src/main/java/org/silverpeas/core/admin/user/dao/GroupDAO.java b/core-library/src/main/java/org/silverpeas/core/admin/user/dao/GroupDAO.java
index c681e3a4cf..ec3ee78d78 100644
--- a/core-library/src/main/java/org/silverpeas/core/admin/user/dao/GroupDAO.java
+++ b/core-library/src/main/java/org/silverpeas/core/admin/user/dao/GroupDAO.java
@@ -68,8 +68,8 @@ public class GroupDAO {
private static final String USER_ROLE_GROUPS_TABLE = "st_userrole_group_rel";
private static final String SPACE_ROLE_GROUP = "st_spaceuserrole_group_rel";
private static final String GROUP_COLUMNS_PATTERN =
- "DISTINCT({0}id),{0}specificId,{0}domainId,{0}superGroupId,{0}name,{0}description," +
- "{0}synchroRule,{0}creationDate,{0}saveDate,{0}state,{0}stateSaveDate";
+ "DISTINCT({0}id),{0}specificId,{0}domainId,{0}spaceId,{0}superGroupId,{0}name," +
+ "{0}description,{0}synchroRule,{0}creationDate,{0}saveDate,{0}state,{0}stateSaveDate";
private static final String GROUP_COLUMNS = format(GROUP_COLUMNS_PATTERN, EMPTY);
private static final String SEARCH_GROUP_COLUMNS = format(GROUP_COLUMNS_PATTERN, "g.");
private static final String DOMAIN_ID_CRITERION = "domainId = ?";
@@ -80,6 +80,7 @@ public class GroupDAO {
private static final String GROUP_ID = "groupId";
private static final String GROUP_ID_ATTR = ".groupid";
private static final String SPECIFIC_ID = "specificId";
+ private static final String SPACE_ID = "spaceId";
private static final String DOMAIN_ID = "domainId";
private static final String SUPER_GROUP_ID = "superGroupId";
private static final String NAME = "name";
@@ -110,6 +111,7 @@ public String addGroup(final Connection connection, final GroupDetail group)
JdbcSqlQuery.insertInto(GROUP_TABLE)
.withInsertParam("id", nextId)
.withInsertParam(SPECIFIC_ID, specificId)
+ .withInsertParam(SPACE_ID, group.getSpaceId())
.withInsertParam(DOMAIN_ID, getDomainIdOf(group))
.withInsertParam(SUPER_GROUP_ID, superGroupId)
.withInsertParam(NAME, group.getName())
@@ -260,7 +262,7 @@ public void updateGroup(final Connection connection, final GroupDetail group)
.withUpdateParam(SYNCHRO_RULE, isDefined(group.getRule()) ? group.getRule() : null)
.withUpdateParam(SAVE_DATE, now)
.withUpdateParam(STATE, group.getState())
- .withUpdateParam(STATE_SAVE_DATE, toInstance(group.getStateSaveDate()))
+ .withUpdateParam(STATE_SAVE_DATE, toInstant(group.getStateSaveDate()))
.where(ID_CRITERION, Integer.parseInt(group.getId()))
.executeWith(connection);
}
@@ -306,6 +308,7 @@ public List getAllGroups(Connection connection) throws SQLException
return JdbcSqlQuery.select(GROUP_COLUMNS)
.from(GROUP_TABLE)
.where(STATE).notIn(GroupState.REMOVED)
+ .andNull(SPACE_ID)
.orderBy(NAME)
.executeWith(connection, GroupDAO::fetchGroup);
}
@@ -322,6 +325,7 @@ public List getAllRootGroups(Connection connection) throws SQLExcep
.from(GROUP_TABLE)
.where("superGroupId is null")
.and(STATE).notIn(GroupState.REMOVED)
+ .andNull(SPACE_ID)
.orderBy(NAME)
.executeWith(connection, GroupDAO::fetchGroup);
}
@@ -385,15 +389,18 @@ public GroupDetail getSuperGroup(Connection connection, String groupId) throws S
*
* IMPORTANT: returned groups are {@link GroupState#VALID} ones.
*
- * @param connection the connetion with a data source to use.
+ * @param connection the connection with a data source to use.
* @param criteria a builder with which the criteria the user groups must satisfy has been built.
+ * @param orderByType is the user groups in the returned list have to be ordered by their type.
+ * If true, usual user groups are listed first and then the community ones.
* @return a list slice of user groups matching the criteria or an empty list if no such user groups are
- * found. The slice is set by the pagination criteriion. If no such criterion is provided, then it
+ * found. The slice is set by the pagination criterion. If no such criterion is provided, then it
* is the whole list of groups matching the other criteria.
*/
public ListSlice getGroupsByCriteria(Connection connection,
- GroupsSearchCriteria criteria) throws SQLException {
+ GroupsSearchCriteria criteria, boolean orderByType) throws SQLException {
return new SqlGroupSelectorByCriteriaBuilder(SEARCH_GROUP_COLUMNS)
+ .setOrderingByType(orderByType)
.build(criteria)
.executeWith(connection, GroupDAO::fetchGroup);
}
@@ -572,6 +579,7 @@ private static GroupDetail fetchGroup(ResultSet rs) throws SQLException {
}
group.setName(rs.getString(NAME));
group.setDescription(rs.getString(DESCRIPTION));
+ group.setSpaceId(rs.getString(SPACE_ID));
group.setRule(rs.getString(SYNCHRO_RULE));
group.setCreationDate(rs.getTimestamp(CREATION_DATE));
group.setSaveDate(rs.getTimestamp(SAVE_DATE));
@@ -589,7 +597,7 @@ private int getDomainIdOf(final GroupDetail group) {
return Integer.parseInt(domainId);
}
- private Instant toInstance(final Date aDate) {
+ private Instant toInstant(final Date aDate) {
return aDate == null ? null : aDate.toInstant();
}
}
diff --git a/core-library/src/main/java/org/silverpeas/core/admin/user/dao/SqlGroupSelectorByCriteriaBuilder.java b/core-library/src/main/java/org/silverpeas/core/admin/user/dao/SqlGroupSelectorByCriteriaBuilder.java
index b071480a01..d40cc3de26 100644
--- a/core-library/src/main/java/org/silverpeas/core/admin/user/dao/SqlGroupSelectorByCriteriaBuilder.java
+++ b/core-library/src/main/java/org/silverpeas/core/admin/user/dao/SqlGroupSelectorByCriteriaBuilder.java
@@ -41,11 +41,17 @@
*/
public class SqlGroupSelectorByCriteriaBuilder {
private final String fields;
+ private boolean orderedByType = false;
SqlGroupSelectorByCriteriaBuilder(final String fields) {
this.fields = fields;
}
+ SqlGroupSelectorByCriteriaBuilder setOrderingByType(boolean orderByType) {
+ this.orderedByType = orderByType;
+ return this;
+ }
+
/**
* Builds the SQL query to find the {@link GroupState#VALID} groups of users that match the
* specified criteria.
@@ -63,7 +69,11 @@ public JdbcSqlQuery build(final GroupsSearchCriteria criteria) {
applyCriteriaOnRoles(query, criteria);
applyCriteriaOnSuperGroup(query, criteria);
- query.orderBy("g.name");
+ if (orderedByType) {
+ query.orderBy("g.spaceId desc", "g.name");
+ } else {
+ query.orderBy("g.name");
+ }
if (criteria.isCriterionOnPaginationSet()) {
PaginationPage page = criteria.getCriterionOnPagination();
diff --git a/core-library/src/main/java/org/silverpeas/core/admin/user/model/GroupDetail.java b/core-library/src/main/java/org/silverpeas/core/admin/user/model/GroupDetail.java
index 433aee9ef1..90426d3ae3 100644
--- a/core-library/src/main/java/org/silverpeas/core/admin/user/model/GroupDetail.java
+++ b/core-library/src/main/java/org/silverpeas/core/admin/user/model/GroupDetail.java
@@ -41,6 +41,7 @@
public class GroupDetail implements Group {
private static final long serialVersionUID = 4430574302630237352L;
+ private String spaceId = null;
private String id = null;
private String specificId = null;
private String domainId = null;
@@ -76,6 +77,7 @@ public GroupDetail(GroupDetail toClone) {
id = toClone.id;
specificId = toClone.specificId;
domainId = toClone.domainId;
+ spaceId = toClone.spaceId;
superGroupId = toClone.superGroupId;
name = toClone.name;
description = toClone.description;
@@ -85,6 +87,7 @@ public GroupDetail(GroupDetail toClone) {
saveDate = toClone.getSaveDate();
state = toClone.getState();
stateSaveDate = toClone.getStateSaveDate();
+ setTotalNbUsers(-1);
}
/**
@@ -164,6 +167,14 @@ public void setDescription(String newDescription) {
this.description = Objects.requireNonNullElse(newDescription, "");
}
+ public void setSpaceId(String spaceId) {
+ this.spaceId = spaceId;
+ }
+
+ public String getSpaceId() {
+ return spaceId;
+ }
+
/**
* Set the list of the direct users in the group
*/
@@ -327,6 +338,11 @@ public Date getStateSaveDate() {
return stateSaveDate;
}
+ @Override
+ public boolean isCommunityGroup() {
+ return spaceId != null;
+ }
+
/**
* @param stateSaveDate the date of last user state save (when it changes)
*/
diff --git a/core-library/src/main/java/org/silverpeas/core/admin/user/notification/role/GroupUserUnlinkEventListener.java b/core-library/src/main/java/org/silverpeas/core/admin/user/notification/role/GroupUserUnlinkEventListener.java
index 0247ba1f3a..bd23fd99ed 100644
--- a/core-library/src/main/java/org/silverpeas/core/admin/user/notification/role/GroupUserUnlinkEventListener.java
+++ b/core-library/src/main/java/org/silverpeas/core/admin/user/notification/role/GroupUserUnlinkEventListener.java
@@ -35,6 +35,7 @@
import javax.inject.Inject;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import java.util.stream.Stream;
@@ -90,6 +91,7 @@ private Map> findComponentInstancesGroupedByNotAnymorePlayed
return Stream.concat(Stream.of(groupId),
admin.getPathToGroup(groupId).stream())
.map(admin::getGroupById)
+ .filter(Objects::nonNull)
.filter(g -> !List.of(g.getUserIds()).contains(userId))
.flatMap(g -> Stream.of(admin.getProfileIdsOfGroup(g.getId()))
.map(admin::getProfileInst)
diff --git a/core-library/src/test/resources/org/silverpeas/multilang/generalMultilang.properties b/core-library/src/test/resources/org/silverpeas/multilang/generalMultilang.properties
index d7f55ae72e..fea21482e8 100644
--- a/core-library/src/test/resources/org/silverpeas/multilang/generalMultilang.properties
+++ b/core-library/src/test/resources/org/silverpeas/multilang/generalMultilang.properties
@@ -467,4 +467,5 @@ GML.reminder=Rappel
GML.before=avant
GML.action.selection.delete=Supprimer la s\u00e9lection
GML.action.selection.delete.confirm=Etes-vous s\u00fbr(e) de vouloir supprimer d\u00e9finitivement votre s\u00e9lection ?
-GML.Anonymous=Anonyme
\ No newline at end of file
+GML.Anonymous=Anonyme
+GML.appGroup_s=Groupe(s) applicatif(s)
\ No newline at end of file
diff --git a/core-library/src/test/resources/org/silverpeas/multilang/generalMultilang_de.properties b/core-library/src/test/resources/org/silverpeas/multilang/generalMultilang_de.properties
index ccebbd7941..40d4d67464 100644
--- a/core-library/src/test/resources/org/silverpeas/multilang/generalMultilang_de.properties
+++ b/core-library/src/test/resources/org/silverpeas/multilang/generalMultilang_de.properties
@@ -466,4 +466,5 @@ GML.reminder=Reminder
GML.before=before
GML.action.selection.delete=Auswahl l\u00f6schen
GML.action.selection.delete.confirm=M\u00f6chten Sie Ihre Auswahl wirklich dauerhaft l\u00f6schen?
-GML.Anonymous=anonym
\ No newline at end of file
+GML.Anonymous=anonym
+GML.appGroup_s=Anwendungsgruppe(n)
\ No newline at end of file
diff --git a/core-library/src/test/resources/org/silverpeas/multilang/generalMultilang_en.properties b/core-library/src/test/resources/org/silverpeas/multilang/generalMultilang_en.properties
index 3b26dea281..8386f8054f 100644
--- a/core-library/src/test/resources/org/silverpeas/multilang/generalMultilang_en.properties
+++ b/core-library/src/test/resources/org/silverpeas/multilang/generalMultilang_en.properties
@@ -467,4 +467,5 @@ GML.reminder=Reminder
GML.before=before
GML.action.selection.delete=Delete selection
GML.action.selection.delete.confirm=Are you sure you want to permanently delete your selection?
-GML.Anonymous=Anonymous
\ No newline at end of file
+GML.Anonymous=Anonymous
+GML.appGroup_s=Application(s) Group(s)
\ No newline at end of file
diff --git a/core-library/src/test/resources/org/silverpeas/multilang/generalMultilang_fr.properties b/core-library/src/test/resources/org/silverpeas/multilang/generalMultilang_fr.properties
index 775775fd85..30ef0c7685 100644
--- a/core-library/src/test/resources/org/silverpeas/multilang/generalMultilang_fr.properties
+++ b/core-library/src/test/resources/org/silverpeas/multilang/generalMultilang_fr.properties
@@ -468,4 +468,5 @@ GML.url.path.notFound=Le chemin de l''URL ''{0}'' n''est pas pris en charge
GML.content=Contenu
GML.reminder=Rappel
GML.before=avant
-GML.Anonymous=Anonyme
\ No newline at end of file
+GML.Anonymous=Anonyme
+GML.appGroup_s=Groupe(s) applicatif(s)
\ No newline at end of file
diff --git a/core-services/chat/src/integration-test/resources/org/silverpeas/core/chat/create-database.sql b/core-services/chat/src/integration-test/resources/org/silverpeas/core/chat/create-database.sql
index e0a7f6546c..6cbf61fd6e 100644
--- a/core-services/chat/src/integration-test/resources/org/silverpeas/core/chat/create-database.sql
+++ b/core-services/chat/src/integration-test/resources/org/silverpeas/core/chat/create-database.sql
@@ -81,6 +81,7 @@ CREATE TABLE ST_Space
look varchar(50),
displaySpaceFirst smallint,
isPersonal smallint,
+ isCommunity SMALLINT DEFAULT(0) NOT NULL,
CONSTRAINT PK_Space PRIMARY KEY (id),
CONSTRAINT UN_Space_1 UNIQUE(domainFatherId, name)
);
@@ -191,6 +192,7 @@ CREATE TABLE ST_Group
id int NOT NULL,
domainId int NOT NULL,
specificId varchar(500) NOT NULL,
+ spaceId VARCHAR(500),
superGroupId int,
name varchar(100) NOT NULL,
description varchar(400),
diff --git a/core-services/workflow/src/integration-test/resources/org/silverpeas/core/workflow/engine/user/create-tables.sql b/core-services/workflow/src/integration-test/resources/org/silverpeas/core/workflow/engine/user/create-tables.sql
index 88e407307d..54d8b61a56 100644
--- a/core-services/workflow/src/integration-test/resources/org/silverpeas/core/workflow/engine/user/create-tables.sql
+++ b/core-services/workflow/src/integration-test/resources/org/silverpeas/core/workflow/engine/user/create-tables.sql
@@ -18,7 +18,8 @@ CREATE TABLE ST_Space
isInheritanceBlocked int default(0) NOT NULL,
look varchar(50),
displaySpaceFirst smallint,
- isPersonal smallint
+ isPersonal smallint,
+ isCommunity SMALLINT DEFAULT(0) NOT NULL
);
CREATE TABLE ST_SpaceI18N (
@@ -123,6 +124,7 @@ CREATE TABLE ST_Group (
saveDate timestamp,
state varchar(30) NOT NULL,
stateSaveDate timestamp NOT NULL,
+ spaceId varchar(500),
CONSTRAINT PK_Group PRIMARY KEY (id),
CONSTRAINT UN_Group_1 UNIQUE (specificId, domainId),
CONSTRAINT UN_Group_2 UNIQUE (superGroupId, name, domainId),
diff --git a/core-war/src/integration-test/resources/org/silverpeas/web/silverstatistics/control/create-database.sql b/core-war/src/integration-test/resources/org/silverpeas/web/silverstatistics/control/create-database.sql
index 28429baee9..b12f96a2e2 100644
--- a/core-war/src/integration-test/resources/org/silverpeas/web/silverstatistics/control/create-database.sql
+++ b/core-war/src/integration-test/resources/org/silverpeas/web/silverstatistics/control/create-database.sql
@@ -31,6 +31,7 @@ CREATE TABLE ST_Group
id int NOT NULL,
domainId int NOT NULL,
specificId varchar(500) NOT NULL,
+ spaceId VARCHAR(500),
superGroupId int,
name varchar(100) NOT NULL,
description varchar(400),
diff --git a/core-war/src/integration-test/resources/org/silverpeas/web/usercalendar/socialnetwork/create-database.sql b/core-war/src/integration-test/resources/org/silverpeas/web/usercalendar/socialnetwork/create-database.sql
index aa7369300e..7f131f86ea 100644
--- a/core-war/src/integration-test/resources/org/silverpeas/web/usercalendar/socialnetwork/create-database.sql
+++ b/core-war/src/integration-test/resources/org/silverpeas/web/usercalendar/socialnetwork/create-database.sql
@@ -20,7 +20,8 @@ CREATE TABLE IF NOT EXISTS ST_Space
isInheritanceBlocked int default(0) NOT NULL,
look varchar(50),
displaySpaceFirst smallint,
- isPersonal smallint
+ isPersonal smallint,
+ isCommunity SMALLINT DEFAULT(0) NOT NULL
);
CREATE TABLE IF NOT EXISTS SB_ContentManager_Instance
diff --git a/core-war/src/main/java/org/silverpeas/web/jobdomain/JobDomainSettings.java b/core-war/src/main/java/org/silverpeas/web/jobdomain/JobDomainSettings.java
index 0634c52d59..04b4e139de 100644
--- a/core-war/src/main/java/org/silverpeas/web/jobdomain/JobDomainSettings.java
+++ b/core-war/src/main/java/org/silverpeas/web/jobdomain/JobDomainSettings.java
@@ -30,52 +30,62 @@
import org.silverpeas.kernel.bundle.SettingBundle;
import java.util.Arrays;
-import java.util.Comparator;
/**
- * This class manage the informations needed for groups navigation and browse PRE-REQUIRED : the
+ * This class manage the information needed for groups navigation and browse PRE-REQUIRED : the
* Group passed in the constructor MUST BE A {@link GroupState#VALID} GROUP (with Id, etc...)
- * @t.leroi
+ * @author t.leroi
*/
public class JobDomainSettings {
- public static int m_UsersByPage = 10;
- public static int m_GroupsByPage = 10;
- public static int m_MinLengthLogin = 5;
- public static boolean m_UserAddingAllowedForGroupManagers = false;
- public static boolean m_UseCommunityManagement = false;
- public static boolean usersInDomainQuotaActivated = false;
- public static boolean lastConnectionColumnEnabled = true;
+ private static final int USERS_PER_PAGE;
+ private static final int GROUPS_PER_PAGE;
+ private static final int LOGIN_MIN_LENGTH;
+ private static final boolean USER_ADDING_FOR_GROUP_MANAGERS;
+ private static final boolean USERS_IN_DOMAIN_QUOTA_ACTIVATED;
+ private static final boolean LAST_CONNECTION_COLUMN_ENABLED;
static {
SettingBundle rs = ResourceLocator.getSettingBundle(
"org.silverpeas.jobDomainPeas.settings.jobDomainPeasSettings");
- m_UsersByPage = rs.getInteger("UsersByPage", 10);
- m_GroupsByPage = rs.getInteger("GroupsByPage", 10);
- m_MinLengthLogin = rs.getInteger("MinLengthLogin", 5);
- m_UserAddingAllowedForGroupManagers = rs.getBoolean("UserAddingAllowedForGroupManagers", false);
- m_UseCommunityManagement = rs.getBoolean("UseCommunityManagement", false);
- usersInDomainQuotaActivated = rs.getBoolean("quota.domain.users.activated", false);
- lastConnectionColumnEnabled = rs.getBoolean("domain.users.columns.lastconnection", true);
+ USERS_PER_PAGE = rs.getInteger("UsersByPage", 10);
+ GROUPS_PER_PAGE = rs.getInteger("GroupsByPage", 10);
+ LOGIN_MIN_LENGTH = rs.getInteger("MinLengthLogin", 5);
+ USER_ADDING_FOR_GROUP_MANAGERS = rs.getBoolean("UserAddingAllowedForGroupManagers", false);
+ USERS_IN_DOMAIN_QUOTA_ACTIVATED = rs.getBoolean("quota.domain.users.activated", false);
+ LAST_CONNECTION_COLUMN_ENABLED = rs.getBoolean("domain.users.columns.lastconnection", true);
}
static public void sortGroups(Group[] toSort) {
- Arrays.sort(toSort, new Comparator() {
-
- public int compare(Group o1, Group o2) {
- return o1.compareTo(o2);
- }
- });
+ Arrays.sort(toSort, Comparable::compareTo);
}
static public void sortUsers(UserDetail[] toSort) {
- Arrays.sort(toSort, new Comparator() {
+ Arrays.sort(toSort, UserDetail::compareTo);
+ }
+
+ public static int getUsersCountPerPage() {
+ return USERS_PER_PAGE;
+ }
+
+ public static int getGroupsNbPerPage() {
+ return GROUPS_PER_PAGE;
+ }
- public int compare(UserDetail o1, UserDetail o2) {
- return o1.compareTo(o2);
- }
+ public static int getLoginMinLength() {
+ return LOGIN_MIN_LENGTH;
+ }
+
+ public static boolean isUserAddingAllowedForGroupManagers() {
+ return USER_ADDING_FOR_GROUP_MANAGERS;
+ }
+
+ public static boolean isUsersInDomainQuotaEnabled() {
+ return USERS_IN_DOMAIN_QUOTA_ACTIVATED;
+ }
- });
+ public static boolean isLastConnectionInfoEnabled() {
+ return LAST_CONNECTION_COLUMN_ENABLED;
}
}
diff --git a/core-war/src/main/java/org/silverpeas/web/jobdomain/control/JobDomainPeasSessionController.java b/core-war/src/main/java/org/silverpeas/web/jobdomain/control/JobDomainPeasSessionController.java
index e68c06d568..17ce69669b 100644
--- a/core-war/src/main/java/org/silverpeas/web/jobdomain/control/JobDomainPeasSessionController.java
+++ b/core-war/src/main/java/org/silverpeas/web/jobdomain/control/JobDomainPeasSessionController.java
@@ -181,11 +181,11 @@ protected JobDomainPeasSessionController(final MainSessionController controller,
}
public int getMinLengthLogin() {
- return JobDomainSettings.m_MinLengthLogin;
+ return JobDomainSettings.getLoginMinLength();
}
public boolean isUserAddingAllowedForGroupManager() {
- return JobDomainSettings.m_UserAddingAllowedForGroupManagers;
+ return JobDomainSettings.isUserAddingAllowedForGroupManagers();
}
@Override
@@ -276,8 +276,7 @@ private boolean isAccessGrantedOnNotFullAdminAccess(final String domainId,
}
granted = groupStream.map(Pair::getSecond).anyMatch(domainId::equals);
if (!granted && readOnly) {
- granted = (equalsUserDomain || Domain.MIXED_DOMAIN_ID.equals(domainId)) &&
- (isOnlySpaceManager() || isCommunityManager());
+ granted = (equalsUserDomain || Domain.MIXED_DOMAIN_ID.equals(domainId)) && isOnlySpaceManager();
}
}
return granted;
@@ -766,10 +765,10 @@ private void checkLoginDuringCSVImport(String login, int lineNumber, StringBuild
String loginError = checkCSVData(login, lineNumber, 3, true, 50);
if (StringUtil.isDefined(loginError)) {
listErrors.append(loginError);
- } else if (login.length() < JobDomainSettings.m_MinLengthLogin) {// verifier
+ } else if (login.length() < JobDomainSettings.getLoginMinLength()) {// verifier
listErrors.append(getErrorMessage(lineNumber, 3, login));
listErrors.append(getString("JDP.nbCarMin")).append(" ").append(
- JobDomainSettings.m_MinLengthLogin).append(" ").append(getString("JDP.caracteres")).
+ JobDomainSettings.getLoginMinLength()).append(" ").append(getString("JDP.caracteres")).
append(BR_ELEMENT);
} else {
// verif login unique
@@ -1302,6 +1301,28 @@ public boolean isGroupRoot(String groupId) {
getSuperGroupId()) || "-1".equals(gr.getSuperGroupId()));
}
+ /**
+ * Gets all the root groups of the current user domain, split in two according their type: the
+ * first ones are those managed by the domain whereas the second ones are the application managed
+ * groups. Later are defined only in the mixed domain so for any other user domains the second
+ * returned array in the pair is empty.
+ *
+ * @return a pair of two arrays: the first one with the groups managed by the current user domain
+ * and the second one the groups managed by applications. Latter is empty if the user domain isn't
+ * the mixed one.
+ * @throws JobDomainPeasException if an error occurs while getting the root groups of the current
+ * domain.
+ */
+ public Pair getRootGroupsPerType() throws JobDomainPeasException {
+ var rootGroups = getSubGroups(false);
+ if (!getTargetDomain().isMixedOne()) {
+ return Pair.of(rootGroups, new Group[0]);
+ }
+ var allRootGroups = splitGroupsByType(rootGroups);
+ return Pair.of(allRootGroups.getFirst().toArray(new Group[0]),
+ allRootGroups.getSecond().toArray(new Group[0]));
+ }
+
public Group[] getSubGroups(boolean isParentGroup) throws JobDomainPeasException {
Group[] groups;
@@ -1377,6 +1398,11 @@ private void appendSeparator(StringBuilder sb) {
public boolean createGroup(String idParent, String groupName,
String groupDescription, String groupRule) throws JobDomainPeasException {
+ GroupDetail parent = adminCtrl.getGroupById(idParent);
+ if (parent != null && parent.isCommunityGroup()) {
+ throw new JobDomainPeasException(idParent + " is an application managed group");
+ }
+
GroupDetail theNewGroup = new GroupDetail();
String rule = groupRule;
@@ -1410,6 +1436,9 @@ public boolean modifyGroup(String idGroup, String groupName,
if (theModifiedGroup == null) {
throw new JobDomainPeasException(unknown("group", idGroup));
}
+ if (theModifiedGroup.isCommunityGroup()) {
+ throw new JobDomainPeasException(idGroup + " is an application managed group");
+ }
boolean isSynchronizationToPerform =
isDefined(groupRule) && !groupRule.equalsIgnoreCase(theModifiedGroup.getRule());
String rule = groupRule;
@@ -1460,7 +1489,11 @@ public boolean restoreGroup(String groupId) {
return true;
}
- public boolean removeGroup(String groupId) {
+ public boolean removeGroup(String groupId) throws JobDomainPeasException {
+ var group = adminCtrl.getGroupById(groupId);
+ if (group != null && group.isCommunityGroup()) {
+ throw new JobDomainPeasException(groupId + " is an application managed group");
+ }
if (adminCtrl.removeGroupById(groupId).isEmpty()) {
SilverLogger.getLogger(this).warn(format("Group {0} is already removed", groupId));
}
@@ -1469,9 +1502,13 @@ public boolean removeGroup(String groupId) {
return true;
}
- public boolean deleteGroup(String groupId) {
+ public boolean deleteGroup(String groupId) throws JobDomainPeasException {
boolean deleted = false;
- if (adminCtrl.getGroupById(groupId) != null) {
+ var group = adminCtrl.getGroupById(groupId);
+ if (group != null) {
+ if (group.isCommunityGroup()) {
+ throw new JobDomainPeasException(groupId + " is an application managed group");
+ }
deleted = !adminCtrl.deleteGroupById(groupId).isEmpty();
}
if (!deleted) {
@@ -1603,7 +1640,7 @@ public List getAllDomains() {
// and all classic domains
domains.addAll(Arrays.asList(adminCtrl.getAllDomains()));
- } else if (isOnlySpaceManager() || isCommunityManager()) {
+ } else if (isOnlySpaceManager()) {
// return mixed domain...
domains.add(adminCtrl.getDomain(Domain.MIXED_DOMAIN_ID));
@@ -1632,25 +1669,6 @@ private boolean isNotManagerOfCurrentDomain() {
return true;
}
- public boolean isCommunityManager() {
- if (!JobDomainSettings.m_UseCommunityManagement) {
- return false;
- }
-
- // check if user is able to manage at least one space and its corresponding group
- List groups = getUserManageableGroups();
- String[] spaceIds = getUserManageableSpaceIds();
- for (String spaceId : spaceIds) {
- SpaceInstLight space = getOrganisationController().getSpaceInstLightById(spaceId);
- for (Group group : groups) {
- if (space.getName().equalsIgnoreCase(group.getName())) {
- return true;
- }
- }
- }
- return false;
- }
-
public boolean isGroupManagerOnCurrentGroup() {
return getTargetGroup() != null && isGroupManagerOnGroup(getTargetGroup().getId());
}
@@ -1675,17 +1693,42 @@ public boolean isGroupManagerDirectlyOnCurrentGroup() {
return manageableGroupIds.contains(getTargetGroup().getId());
}
- public Group[] getAllRootGroups() {
+ /**
+ * Gets all the root groups of the current user domain. The groups are splitted in two according
+ * to their type. The first ones are the domain groups whereas the second ones are the application
+ * groups. Application groups are only defined in the mixed domain; in any other domain, there is
+ * no application groups.
+ *
+ * @return a pair with the domain's user groups and with the application groups.
+ */
+ public Pair getAllRootGroups() {
if (targetDomainId.isEmpty()) {
- return new Group[0];
+ return Pair.of(new Group[0], new Group[0]);
}
Group[] selGroupsArray = targetDomain.getGroupPage();
if (isOnlyGroupManager()) {
selGroupsArray = filterGroupsToGroupManager(selGroupsArray);
}
- JobDomainSettings.sortGroups(selGroupsArray);
- return selGroupsArray;
+
+ var allRootGroups = splitGroupsByType(selGroupsArray);
+ allRootGroups.getFirst().sort(Group::compareTo);
+ allRootGroups.getSecond().sort(Group::compareTo);
+ return Pair.of(allRootGroups.getFirst().toArray(new Group[0]),
+ allRootGroups.getSecond().toArray(new Group[0]));
+ }
+
+ private Pair, List> splitGroupsByType(Group[] groups) {
+ List domainGroups = new ArrayList<>();
+ List applicationGroups = new ArrayList<>();
+ for (Group group : groups) {
+ if (group.isCommunityGroup()) {
+ applicationGroups.add(group);
+ } else {
+ domainGroups.add(group);
+ }
+ }
+ return Pair.of(domainGroups, applicationGroups);
}
private Group[] filterGroupsToGroupManager(Group[] groups) {
@@ -1735,7 +1778,7 @@ public String createSQLDomain(String domainName, String domainDescription,
try {
// Getting quota filled
- if (JobDomainSettings.usersInDomainQuotaActivated) {
+ if (JobDomainSettings.isUsersInDomainQuotaEnabled()) {
domainToCreate.setUserDomainQuotaMaxCount(usersInDomainQuotaMaxCount);
}
@@ -1743,7 +1786,7 @@ public String createSQLDomain(String domainName, String domainDescription,
DomainServiceProvider.getDomainService(DomainType.SQL)).createDomain(domainToCreate);
domainToCreate.setId(domainId);
- if (JobDomainSettings.usersInDomainQuotaActivated) {
+ if (JobDomainSettings.isUsersInDomainQuotaEnabled()) {
// Registering "users in domain" quota
DomainServiceProvider.getUserDomainQuotaService().initialize(
UserDomainQuotaKey.from(domainToCreate),
@@ -1833,7 +1876,7 @@ private String reallyUpdateDomain(Domain domain, String usersInDomainQuotaMaxCou
try {
boolean quotaDefined = isDefined(usersInDomainQuotaMaxCount);
- if (JobDomainSettings.usersInDomainQuotaActivated && quotaDefined) {
+ if (JobDomainSettings.isUsersInDomainQuotaEnabled() && quotaDefined) {
// Getting quota filled
domain.setUserDomainQuotaMaxCount(usersInDomainQuotaMaxCount);
}
@@ -1843,7 +1886,7 @@ private String reallyUpdateDomain(Domain domain, String usersInDomainQuotaMaxCou
throw new JobDomainPeasException(failureOnUpdate("domain", domain.getName()));
}
- if (JobDomainSettings.usersInDomainQuotaActivated && quotaDefined) {
+ if (JobDomainSettings.isUsersInDomainQuotaEnabled() && quotaDefined) {
// Registering "users in domain" quota
DomainServiceProvider.getUserDomainQuotaService().initialize(
UserDomainQuotaKey.from(domain), domain.getUserDomainQuota().getMaxCount());
@@ -2108,7 +2151,7 @@ public String getSynchroReport() {
PrintWriter pw = new PrintWriter(sw);
errorOccurred.printStackTrace(pw);
- return errorOccurred.toString() + "\n" + sw.getBuffer().toString();
+ return errorOccurred.toString() + "\n" + sw.getBuffer();
}
return synchroReport;
}
@@ -2176,26 +2219,6 @@ public UserDetail checkUser(UserDetail userToCheck) {
return null;
}
- /**
- * @return true if community management is activated and target user belongs to one group
- * manageable by current user
- */
- public boolean isUserInAtLeastOneGroupManageableByCurrentUser() {
- if (!JobDomainSettings.m_UseCommunityManagement) {
- return false;
- }
- List groupIds = getUserManageableGroupIds();
- for (String groupId : groupIds) {
- UserDetail[] users = getOrganisationController().getAllUsersOfGroup(groupId);
- UserDetail user = getUser(targetUserId, users);
-
- if (user != null) {
- return true;
- }
- }
- return false;
- }
-
private UserDetail getUser(String userId, UserDetail[] users) {
for (UserDetail userDetail : users) {
if (userId.equals(userDetail.getId())) {
@@ -2542,6 +2565,9 @@ public void cutGroup(String groupId) throws AdminException {
private void copyOrCutGroup(String groupId, boolean cut) throws AdminException {
try {
Group group = adminCtrl.getGroupById(groupId);
+ if (group.isCommunityGroup()) {
+ throw new AdminException(groupId + " is an application managed group");
+ }
GroupSelection groupSelection = new GroupSelection(group);
groupSelection.setCut(cut);
addClipboardSelection(groupSelection);
@@ -2556,8 +2582,8 @@ private void copyOrCutGroup(String groupId, boolean cut) throws AdminException {
* of the current domain if there is no current group. The group to paste has to belong to the
* same current domain and there shouldn't be any group having the same name in the current group
* or among the root groups of the domain (in the case there is no current group). Any selected
- * group which don't belong to the same domain will be ignored whereas an exception will be
- * thrown if there is already a group with the same name.
+ * group which don't belong to the same domain will be ignored whereas an exception will be thrown
+ * if there is already a group with the same name.
*
* @throws AdminException if an error occurs while pasting the given group of users.
*/
@@ -2576,7 +2602,7 @@ public void pasteGroup() throws AdminException {
if (clipObject != null && clipObject.isDataFlavorSupported(GroupSelection.GROUP_FLAVOR)) {
GroupDetail group =
(GroupDetail) clipObject.getTransferData(GroupSelection.GROUP_FLAVOR);
- if (Objects.equals(group.getDomainId(), domainId)) {
+ if (Objects.equals(group.getDomainId(), domainId) && !group.isCommunityGroup()) {
if (clipObject.isCut()) {
adminCtrl.moveGroup(group, parentGroupId);
refresh();
diff --git a/core-war/src/main/java/org/silverpeas/web/jobdomain/servlets/JobDomainPeasRequestRouter.java b/core-war/src/main/java/org/silverpeas/web/jobdomain/servlets/JobDomainPeasRequestRouter.java
index 08672e1a73..9addb8b5f8 100644
--- a/core-war/src/main/java/org/silverpeas/web/jobdomain/servlets/JobDomainPeasRequestRouter.java
+++ b/core-war/src/main/java/org/silverpeas/web/jobdomain/servlets/JobDomainPeasRequestRouter.java
@@ -726,11 +726,6 @@ public String getAdminDestination(String function, JobDomainPeasSessionControlle
jobDomainSC.getString("JDP.userAdd") + "..."));
request.setAttribute(MIN_LENGTH_LOGIN_ATTR, jobDomainSC.getMinLengthLogin());
request.setAttribute(CURRENT_USER_ATTR, jobDomainSC.getUserDetail());
- // if community management is activated, add groups on this user is manager
- if (JobDomainSettings.m_UseCommunityManagement) {
- request.setAttribute("GroupsManagedByCurrentUser", jobDomainSC.getUserManageableGroups());
- }
-
destination = USER_CREATE_DEST;
} else if (function.startsWith("displayUsersCsvImport")) {
request.setAttribute(GROUPS_PATH_ATTR, jobDomainSC
@@ -914,7 +909,9 @@ public String getAdminDestination(String function, JobDomainPeasSessionControlle
}
long domainRight = jobDomainSC.getDomainActions();
request.setAttribute(THE_USER_ATTR, jobDomainSC.getUserDetail());
- request.setAttribute("subGroups", jobDomainSC.getSubGroups(false));
+ var rootGroups = jobDomainSC.getRootGroupsPerType();
+ request.setAttribute("subGroups", rootGroups.getFirst());
+ request.setAttribute("appGroups", rootGroups.getSecond());
request.setAttribute("subUsers", jobDomainSC.getSubUsers(false));
setRightManagementAttributes(request, domainRight);
@@ -951,8 +948,6 @@ public String getAdminDestination(String function, JobDomainPeasSessionControlle
setRightManagementAttributes(request, domainRight);
request.setAttribute("isX509Enabled", (domainRight & ACTION_X509_USER) != 0);
request.setAttribute(IS_ONLY_GROUP_MANAGER_ATTR, jobDomainSC.isOnlyGroupManager());
- request.setAttribute("userManageableByGroupManager", jobDomainSC.
- isUserInAtLeastOneGroupManageableByCurrentUser());
request.setAttribute(IS_ONLY_SPACE_MANAGER_ATTR, jobDomainSC.isOnlySpaceManager());
}
try {
@@ -973,7 +968,9 @@ public String getAdminDestination(String function, JobDomainPeasSessionControlle
jobDomainSC.setTargetDomain(domains.get(0).getId());
}
request.setAttribute("allDomains", domains);
- request.setAttribute("allRootGroups", jobDomainSC.getAllRootGroups());
+ var allRootGroup = jobDomainSC.getAllRootGroups();
+ request.setAttribute("domainRootGroups", allRootGroup.getFirst());
+ request.setAttribute("appRootGroups", allRootGroup.getSecond());
request.setAttribute("CurrentDomain", jobDomainSC.getTargetDomain());
} else if ("groupManagers.jsp".equals(destination)) {
request.setAttribute(GROUP_OBJECT_ATTR, jobDomainSC.getTargetGroup());
diff --git a/core-war/src/main/java/org/silverpeas/web/jobstartpage/JobStartPagePeasSettings.java b/core-war/src/main/java/org/silverpeas/web/jobstartpage/JobStartPagePeasSettings.java
index cc853798d4..c5e068f470 100644
--- a/core-war/src/main/java/org/silverpeas/web/jobstartpage/JobStartPagePeasSettings.java
+++ b/core-war/src/main/java/org/silverpeas/web/jobstartpage/JobStartPagePeasSettings.java
@@ -28,60 +28,54 @@
/**
* This class manage the informations needed for job start page
- * @c.bonin
+ * @author c.bonin
*/
public class JobStartPagePeasSettings {
- public static boolean m_IsProfileEditable;
- public static boolean isBackupEnable;
- public static boolean isBasketEnable;
- public static boolean useBasketWhenAdmin;
- public static boolean isInheritanceEnable;
- public static boolean isPublicParameterEnable;
- public static boolean useComponentsCopy;
- public static String SPACEDISPLAYPOSITION_AFTER;
- public static String SPACEDISPLAYPOSITION_BEFORE;
- public static String SPACEDISPLAYPOSITION_TODEFINE;
- public static String SPACEDISPLAYPOSITION_CONFIG;
- public static boolean recoverRightsEnable;
- public static String TEMPLATE_PATH;
- public static String CUSTOMERS_TEMPLATE_PATH;
- public static boolean componentsInSpaceQuotaActivated = false;
- public static boolean dataStorageInSpaceQuotaActivated;
- public static long dataStorageInSpaceQuotaDefaultMaxCount;
- public static long dataStorageInPersonalSpaceQuotaDefaultMaxCount;
- public static String defaultAuthorizedFiles;
- public static String defaultForbiddenFiles;
+ public static final boolean IS_PROFILE_EDITABLE;
+ public static final boolean IS_BACKUP_ENABLED;
+ public static final boolean IS_BASKET_ENABLED;
+ public static final boolean USE_BASKET_WHEN_ADMIN;
+ public static final boolean IS_INHERITANCE_ENABLED;
+ public static final boolean IS_PUBLIC_PARAMETER_ENABLED;
+ public static final boolean USE_COMPONENTS_COPY;
+ public static final String SPACE_DISPLAY_POSITION_AFTER;
+ public static final String SPACE_DISPLAY_POSITION_BEFORE;
+ public static final String SPACE_DISPLAY_POSITION_TODEFINE;
+ public static final String SPACE_DISPLAY_POSITION_CONFIG;
+ public static final boolean RECOVER_RIGHTS_ENABLED;
+ public static final String TEMPLATE_PATH;
+ public static final String CUSTOMERS_TEMPLATE_PATH;
+ public static final boolean COMPONENTS_IN_SPACE_QUOTA_ENABLED;
+ public static final boolean DATA_STORAGE_IN_SPACE_QUOTA_ENABLED;
+ public static final long DATA_STORAGE_IN_SPACE_QUOTA_DEFAULT_MAX_COUNT;
+ public static final long DATA_STORAGE_IN_PERSONAL_SPACE_QUOTA_DEFAULT_MAX_COUNT;
+ public static final String DEFAULT_AUTHORIZED_FILES;
+ public static final String DEFAULT_FORBIDDEN_FILES;
static {
SettingBundle rs = ResourceLocator.getSettingBundle(
"org.silverpeas.jobStartPagePeas.settings.jobStartPagePeasSettings");
- m_IsProfileEditable = rs.getBoolean("IsProfileEditable", false);
- isBackupEnable = rs.getBoolean("IsBackupEnable", false);
- isBasketEnable = rs.getBoolean("UseBasket", false);
- useBasketWhenAdmin = rs.getBoolean("UseBasketWhenAdmin", false);
- isInheritanceEnable = rs.getBoolean("UseProfileInheritance", false);
- isPublicParameterEnable = rs.getBoolean("UsePublicParameter", true);
- useComponentsCopy = rs.getBoolean("UseComponentsCopy", false);
- SPACEDISPLAYPOSITION_CONFIG = rs.getString("DisplaySpacePositionConfiguration", "BEFORE");
- SPACEDISPLAYPOSITION_AFTER = rs.getString("DisplaySpacesAfterComponents", "AFTER");
- SPACEDISPLAYPOSITION_BEFORE = rs.getString("DisplaySpacesBeforeComponents", "BEFORE");
- SPACEDISPLAYPOSITION_TODEFINE = rs.getString("DisplaySpacesToDefine", "TODEFINE");
- recoverRightsEnable = rs.getBoolean("EnableRecoverRightsOperation", false);
+ IS_PROFILE_EDITABLE = rs.getBoolean("IsProfileEditable", false);
+ IS_BACKUP_ENABLED = rs.getBoolean("IsBackupEnable", false);
+ IS_BASKET_ENABLED = rs.getBoolean("UseBasket", false);
+ USE_BASKET_WHEN_ADMIN = rs.getBoolean("UseBasketWhenAdmin", false);
+ IS_INHERITANCE_ENABLED = rs.getBoolean("UseProfileInheritance", false);
+ IS_PUBLIC_PARAMETER_ENABLED = rs.getBoolean("UsePublicParameter", true);
+ USE_COMPONENTS_COPY = rs.getBoolean("UseComponentsCopy", false);
+ SPACE_DISPLAY_POSITION_CONFIG = rs.getString("DisplaySpacePositionConfiguration", "BEFORE");
+ SPACE_DISPLAY_POSITION_AFTER = rs.getString("DisplaySpacesAfterComponents", "AFTER");
+ SPACE_DISPLAY_POSITION_BEFORE = rs.getString("DisplaySpacesBeforeComponents", "BEFORE");
+ SPACE_DISPLAY_POSITION_TODEFINE = rs.getString("DisplaySpacesToDefine", "TODEFINE");
+ RECOVER_RIGHTS_ENABLED = rs.getBoolean("EnableRecoverRightsOperation", false);
TEMPLATE_PATH = rs.getString("templatePath");
CUSTOMERS_TEMPLATE_PATH = rs.getString("customersTemplatePath");
- componentsInSpaceQuotaActivated = rs.getBoolean("quota.space.components.activated", false);
- dataStorageInSpaceQuotaActivated = rs.getBoolean("quota.space.datastorage.activated", false);
- dataStorageInSpaceQuotaDefaultMaxCount =
- rs.getLong("quota.space.datastorage.default.maxCount", 0);
- if (dataStorageInSpaceQuotaDefaultMaxCount < 0) {
- dataStorageInSpaceQuotaDefaultMaxCount = 0;
- }
- dataStorageInPersonalSpaceQuotaDefaultMaxCount =
- rs.getLong("quota.personalspace.datastorage.default.maxCount", 0);
- if (dataStorageInPersonalSpaceQuotaDefaultMaxCount < 0) {
- dataStorageInPersonalSpaceQuotaDefaultMaxCount = 0;
- }
- defaultAuthorizedFiles = rs.getString("file.authorized.default", "");
- defaultForbiddenFiles = rs.getString("file.forbidden.default", "");
+ COMPONENTS_IN_SPACE_QUOTA_ENABLED = rs.getBoolean("quota.space.components.activated", false);
+ DATA_STORAGE_IN_SPACE_QUOTA_ENABLED = rs.getBoolean("quota.space.datastorage.activated", false);
+ var quota = rs.getLong("quota.space.datastorage.default.maxCount", 0);
+ DATA_STORAGE_IN_SPACE_QUOTA_DEFAULT_MAX_COUNT = quota < 0 ? 0 : quota;
+ quota = rs.getLong("quota.personalspace.datastorage.default.maxCount", 0);
+ DATA_STORAGE_IN_PERSONAL_SPACE_QUOTA_DEFAULT_MAX_COUNT = quota < 0 ? 0 : quota;
+ DEFAULT_AUTHORIZED_FILES = rs.getString("file.authorized.default", "");
+ DEFAULT_FORBIDDEN_FILES = rs.getString("file.forbidden.default", "");
}
}
diff --git a/core-war/src/main/java/org/silverpeas/web/jobstartpage/control/JobStartPagePeasSessionController.java b/core-war/src/main/java/org/silverpeas/web/jobstartpage/control/JobStartPagePeasSessionController.java
index 87e9441a24..b720d9eb59 100644
--- a/core-war/src/main/java/org/silverpeas/web/jobstartpage/control/JobStartPagePeasSessionController.java
+++ b/core-war/src/main/java/org/silverpeas/web/jobstartpage/control/JobStartPagePeasSessionController.java
@@ -30,17 +30,9 @@
import org.silverpeas.core.admin.component.model.*;
import org.silverpeas.core.admin.quota.exception.QuotaException;
import org.silverpeas.core.admin.quota.exception.QuotaRuntimeException;
-import org.silverpeas.core.admin.service.AdminController;
-import org.silverpeas.core.admin.service.AdminException;
-import org.silverpeas.core.admin.service.Administration;
-import org.silverpeas.core.admin.service.AdministrationServiceProvider;
-import org.silverpeas.core.admin.service.RightRecover;
+import org.silverpeas.core.admin.service.*;
import org.silverpeas.core.admin.service.SpaceProfile;
-import org.silverpeas.core.admin.space.SpaceInst;
-import org.silverpeas.core.admin.space.SpaceInstLight;
-import org.silverpeas.core.admin.space.SpaceProfileInst;
-import org.silverpeas.core.admin.space.SpaceSelection;
-import org.silverpeas.core.admin.space.SpaceServiceProvider;
+import org.silverpeas.core.admin.space.*;
import org.silverpeas.core.admin.space.quota.ComponentSpaceQuotaKey;
import org.silverpeas.core.admin.space.quota.DataStorageSpaceQuotaKey;
import org.silverpeas.core.admin.user.model.Group;
@@ -54,51 +46,31 @@
import org.silverpeas.core.template.SilverpeasTemplate;
import org.silverpeas.core.template.SilverpeasTemplates;
import org.silverpeas.core.ui.DisplayI18NHelper;
-import org.silverpeas.kernel.bundle.LocalizationBundle;
-import org.silverpeas.kernel.util.Pair;
-import org.silverpeas.kernel.bundle.ResourceLocator;
import org.silverpeas.core.util.ServiceProvider;
-import org.silverpeas.kernel.util.StringUtil;
import org.silverpeas.core.util.URLUtil;
import org.silverpeas.core.util.UnitUtil;
import org.silverpeas.core.util.file.FileFolderManager;
import org.silverpeas.core.util.file.FileRepositoryManager;
import org.silverpeas.core.util.file.FileUploadUtil;
-import org.silverpeas.kernel.logging.SilverLogger;
import org.silverpeas.core.util.memory.MemoryUnit;
import org.silverpeas.core.web.look.SilverpeasLook;
import org.silverpeas.core.web.mvc.controller.AbstractAdminComponentSessionController;
import org.silverpeas.core.web.mvc.controller.ComponentContext;
import org.silverpeas.core.web.mvc.controller.MainSessionController;
import org.silverpeas.core.web.selection.Selection;
-import org.silverpeas.core.web.selection.SelectionException;
-import org.silverpeas.web.jobstartpage.AllComponentParameters;
-import org.silverpeas.web.jobstartpage.DisplaySorted;
-import org.silverpeas.web.jobstartpage.JobStartPagePeasException;
-import org.silverpeas.web.jobstartpage.JobStartPagePeasSettings;
-import org.silverpeas.web.jobstartpage.NavBarManager;
-import org.silverpeas.web.jobstartpage.SpaceLookHelper;
+import org.silverpeas.kernel.bundle.LocalizationBundle;
+import org.silverpeas.kernel.bundle.ResourceLocator;
+import org.silverpeas.kernel.logging.SilverLogger;
+import org.silverpeas.kernel.util.Pair;
+import org.silverpeas.kernel.util.StringUtil;
+import org.silverpeas.web.jobstartpage.*;
import java.io.File;
import java.nio.file.Files;
-import java.rmi.RemoteException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
+import java.util.*;
import static org.silverpeas.core.admin.component.model.ComponentInst.getComponentLocalId;
-/**
- * Class declaration
- *
- * @author
- */
public class JobStartPagePeasSessionController extends AbstractAdminComponentSessionController {
public static final int SCOPE_BACKOFFICE = 0;
@@ -121,12 +93,14 @@ public class JobStartPagePeasSessionController extends AbstractAdminComponentSes
// Space sort buffers
SpaceInst[] m_BrothersSpaces = new SpaceInst[0];
ComponentInst[] m_BrothersComponents = new ComponentInst[0];
+ private final CommunityFactory communityFactory;
public JobStartPagePeasSessionController(MainSessionController mainSessionCtrl,
ComponentContext componentContext) {
super(mainSessionCtrl, componentContext,
"org.silverpeas.jobStartPagePeas.multilang.jobStartPagePeasBundle",
- "org.silverpeas.jobStartPagePeas.settings.jobStartPagePeasIcons");
+ "org.silverpeas.jobStartPagePeas.settings.jobStartPagePeasIcons",
+ "org.silverpeas.jobStartPagePeas.settings.jobStartPagePeasSettings");
setComponentRootName(URLUtil.CMP_JOBSTARTPAGEPEAS);
selection = getSelection();
adminController = ServiceProvider.getService(AdminController.class);
@@ -134,6 +108,7 @@ public JobStartPagePeasSessionController(MainSessionController mainSessionCtrl,
JobStartPagePeasSettings.TEMPLATE_PATH);
templateConfiguration.setProperty(SilverpeasTemplate.TEMPLATE_CUSTOM_DIR,
JobStartPagePeasSettings.CUSTOMERS_TEMPLATE_PATH);
+ communityFactory = getCommunityFactory();
}
/**
@@ -144,6 +119,7 @@ public JobStartPagePeasSessionController(final MainSessionController controller,
final String iconFileName, final String settingsFileName) {
super(controller, context, localizedMessagesBundleName, iconFileName, settingsFileName);
adminController = null;
+ communityFactory = getCommunityFactory();
}
// Init at first entry
@@ -190,13 +166,6 @@ public boolean isManagedSpaceRoot() {
return m_isManagedSpaceRoot;
}
- public DisplaySorted[] getManagedSpaceComponents() {
- if (isManagedSpaceRoot()) {
- return getSpaceComponents().toArray(new DisplaySorted[0]);
- }
- return getSubSpaceComponents().toArray(new DisplaySorted[0]);
- }
-
// methods set
public void setSubSpaceId(String subSpaceId) {
if (m_NavBarMgr.setCurrentSubSpace(subSpaceId)) {
@@ -310,24 +279,21 @@ public ProfileInst getManagedInheritedProfile() {
}
public Boolean isProfileEditable() {
- return JobStartPagePeasSettings.m_IsProfileEditable;
+ return JobStartPagePeasSettings.IS_PROFILE_EDITABLE;
}
public Boolean isBackupEnable() {
- return JobStartPagePeasSettings.isBackupEnable;
+ return JobStartPagePeasSettings.IS_BACKUP_ENABLED;
}
public String getConfigSpacePosition() {
- return JobStartPagePeasSettings.SPACEDISPLAYPOSITION_CONFIG;
+ return JobStartPagePeasSettings.SPACE_DISPLAY_POSITION_CONFIG;
}
- /**
+ /*
* ********************* Gestion des espaces ****************************************
*/
- /**
- * @param isNew
- * @return
- */
+
public SpaceInst[] getBrotherSpaces(boolean isNew) {
String[] sids;
SpaceInst spaceint1 = getSpaceInstById();
@@ -353,7 +319,7 @@ public SpaceInst[] getBrotherSpaces(boolean isNew) {
sids = adminController.getAllRootSpaceIds();
}
- if (sids == null || sids.length <= 0) {
+ if (sids == null || sids.length == 0) {
return new SpaceInst[0];
}
if (isNew) {
@@ -400,37 +366,59 @@ public void setSpacePlace(String idSpaceBefore) {
}
public SpaceInst getSpaceInstById(String idSpace) {
- if (idSpace == null || idSpace.length() <= 0) {
+ if (idSpace == null || idSpace.isEmpty()) {
return null;
}
- if (idSpace.length() > 2 && idSpace.substring(0, 2).equals("WA")) {
+ if (idSpace.length() > 2 && idSpace.startsWith("WA")) {
idSpace = idSpace.substring(2);
}
return adminController.getSpaceInstById("WA" + idSpace);
}
- public String createSpace(SpaceInst newSpace) {
- SpaceInst spaceint1 = getSpaceInstById();
- if (spaceint1 != null) {
+ public ComponentInst createCommunitySpace(SpaceInst newSpace) {
+ newSpace.setCommunitySpace(true);
+ newSpace.setInheritanceBlocked(true);
+ newSpace.setFirstPageType(SpaceHomePageType.COMPONENT_INST.ordinal());
+ boolean created = createSpace(newSpace);
+ if (created) {
+ // spawn the component instance dedicated to the community memberships management
+ var componentInst = communityFactory.createCommunity(newSpace);
+ try {
+ addComponentInst(componentInst);
+ } catch (QuotaException e) {
+ // shouldn't occurs
+ SilverLogger.getLogger(this).error(e.getMessage());
+ return null;
+ }
+ return componentInst;
+ }
+ return null;
+ }
+
+ public boolean createSpace(SpaceInst newSpace) {
+ SpaceInst parentSpace = getSpaceInstById();
+ if (parentSpace != null) {
// on est en creation de sous-espace
- newSpace.setDomainFatherId(spaceint1.getId());
+ newSpace.setDomainFatherId(parentSpace.getId());
}
newSpace.setCreatorUserId(getUserId());
String sSpaceInstId = addSpaceInst(newSpace);
if (StringUtil.isDefined(sSpaceInstId)) {
- if (spaceint1 != null) {
+ if (parentSpace != null) {
// on est en creation de sous-espace
setSubSpaceId(sSpaceInstId);
} else {
// on est en creation d'espace
setSpaceId(sSpaceInstId);
}
+ } else {
+ return false;
}
// Only use global variable to set spacePosition
- boolean spaceFirst = !JobStartPagePeasSettings.SPACEDISPLAYPOSITION_AFTER.equalsIgnoreCase(
- JobStartPagePeasSettings.SPACEDISPLAYPOSITION_CONFIG);
+ boolean spaceFirst = !JobStartPagePeasSettings.SPACE_DISPLAY_POSITION_AFTER.equalsIgnoreCase(
+ JobStartPagePeasSettings.SPACE_DISPLAY_POSITION_CONFIG);
newSpace.setDisplaySpaceFirst(spaceFirst);
- return sSpaceInstId;
+ return true;
}
public String addSpaceInst(SpaceInst spaceInst) {
@@ -442,9 +430,9 @@ public String addSpaceInst(SpaceInst spaceInst) {
return res;
}
- public String updateSpaceInst(SpaceInst spaceInst) {
+ public boolean updateSpaceInst(SpaceInst spaceInst) {
spaceInst.setUpdaterUserId(getUserId());
- return adminController.updateSpaceInst(spaceInst);
+ return StringUtil.isDefined(adminController.updateSpaceInst(spaceInst));
}
public SpaceLookHelper getSpaceLookHelper() {
@@ -461,9 +449,9 @@ public SpaceLookHelper getSpaceLookHelper() {
return slh;
}
- public boolean removeExternalElementOfSpaceAppearance(String fileName) {
+ public void removeExternalElementOfSpaceAppearance(String fileName) {
File file = new File(getSpaceLookBasePath(), fileName);
- return FileUtils.deleteQuietly(file);
+ FileUtils.deleteQuietly(file);
}
public void updateSpaceAppearance(List items) throws Exception {
@@ -546,14 +534,14 @@ private void processSpaceCSS(List items, String path) throws Exception
}
}
- public void saveSpaceQuota(final SpaceInst spaceInst, String componentSpaceQuotaMaxCount,
- String dataStorageQuotaMaxCount) {
+ public void saveSpaceQuota(final SpaceInst spaceInst, int componentSpaceQuotaMaxCount,
+ long dataStorageQuotaMaxCount) {
boolean isAdmin = isUserAdmin();
// Component space quota
- if (isAdmin && JobStartPagePeasSettings.componentsInSpaceQuotaActivated) {
+ if (isAdmin && JobStartPagePeasSettings.COMPONENTS_IN_SPACE_QUOTA_ENABLED) {
try {
- if (StringUtil.isDefined(componentSpaceQuotaMaxCount)) {
- spaceInst.setComponentSpaceQuotaMaxCount(Integer.parseInt(componentSpaceQuotaMaxCount));
+ if (componentSpaceQuotaMaxCount >= 0) {
+ spaceInst.setComponentSpaceQuotaMaxCount(componentSpaceQuotaMaxCount);
}
SpaceServiceProvider.getComponentSpaceQuotaService().initialize(
ComponentSpaceQuotaKey.from(spaceInst), spaceInst.getComponentSpaceQuota().getMaxCount());
@@ -564,11 +552,11 @@ public void saveSpaceQuota(final SpaceInst spaceInst, String componentSpaceQuota
}
// Data storage quota
- if (isAdmin && JobStartPagePeasSettings.dataStorageInSpaceQuotaActivated) {
+ if (isAdmin && JobStartPagePeasSettings.DATA_STORAGE_IN_SPACE_QUOTA_ENABLED) {
try {
- if (StringUtil.isDefined(dataStorageQuotaMaxCount)) {
+ if (dataStorageQuotaMaxCount >= 0) {
spaceInst.setDataStorageQuotaMaxCount(UnitUtil.convertTo(
- Long.parseLong(dataStorageQuotaMaxCount), MemoryUnit.MB, MemoryUnit.B));
+ dataStorageQuotaMaxCount, MemoryUnit.MB, MemoryUnit.B));
}
SpaceServiceProvider.getDataStorageSpaceQuotaService().initialize(
DataStorageSpaceQuotaKey.from(spaceInst), spaceInst.getDataStorageQuota().getMaxCount());
@@ -601,17 +589,16 @@ private boolean isRemovingSpaceAllowed(String spaceId) {
return false;
}
- public String deleteSpace(String spaceId) {
+ public void deleteSpace(String spaceId) {
if (!isRemovingSpaceAllowed(spaceId)) {
SilverLogger.getLogger(this)
.error("User " + getUserId() + " isn't allowed to delete space " + spaceId);
- return "";
} else {
SpaceInst spaceint1 = adminController.getSpaceInstById(spaceId);
- boolean definitiveDelete = !JobStartPagePeasSettings.isBasketEnable;
- if (JobStartPagePeasSettings.isBasketEnable && isUserAdmin()) {
- definitiveDelete = !JobStartPagePeasSettings.useBasketWhenAdmin;
+ boolean definitiveDelete = !JobStartPagePeasSettings.IS_BASKET_ENABLED;
+ if (JobStartPagePeasSettings.IS_BASKET_ENABLED && isUserAdmin()) {
+ definitiveDelete = !JobStartPagePeasSettings.USE_BASKET_WHEN_ADMIN;
}
String res = adminController.deleteSpaceInstById(getUserDetail(), spaceint1.getId(),
@@ -623,7 +610,6 @@ public String deleteSpace(String spaceId) {
} else {
setManagedSpaceId(getSpaceId(), true);
}
- return res;
}
}
@@ -636,38 +622,31 @@ public void recoverSpaceRights(String spaceId) throws AdminException {
}
}
- /**
+ /*
* ********************* Gestion des managers d'espaces ****************************************
*/
- public SpaceProfile getCurrentSpaceProfile(String role) throws AdminException {
+
+ public SpaceProfile getCurrentSpaceProfile(String role) {
return getOrganisationController()
.getSpaceProfile(getManagedSpaceId(), SilverpeasRole.fromString(role));
}
// user panel de selection de n groupes et n users
- public void initUserPanelSpaceForGroupsUsers(String compoURL, List userIds,
- List groupIds) throws SelectionException {
- SpaceInst spaceint1 = getSpaceInstById();
-
+ public void initUserPanelSpaceForGroupsUsers(List userIds,
+ List groupIds) {
selection.resetAll();
selection.setFilterOnDeactivatedState(false);
String hostSpaceName = getMultilang().getString("JSPP.manageHomePage");
selection.setHostSpaceName(hostSpaceName);
- Pair hostComponentName;
String idFather = getSpaceInstById().getDomainFatherId();
- if (idFather != null && !idFather.equals("0")) {// je suis sur un ss-espace
- SpaceInst spaceFather = getSpaceInstById(idFather);
- hostComponentName = new Pair<>(spaceFather.getName() + " > " + getSpaceInstById().
- getName(), null);
- } else {
- hostComponentName = new Pair<>(getSpaceInstById().getName(), null);
- }
- selection.setHostComponentName(hostComponentName);
+ setHostComponentName(idFather);
LocalizationBundle generalMessage = ResourceLocator.getGeneralLocalizationBundle(getLanguage());
+ //noinspection rawtypes
Pair[] hostPath = {new Pair<>(generalMessage.getString("GML.selection"), null)};
+ //noinspection unchecked
selection.setHostPath(hostPath);
selection.setPopupMode(true);
selection.setHtmlFormElementId("roleItems");
@@ -676,6 +655,18 @@ public void initUserPanelSpaceForGroupsUsers(String compoURL, List userI
selection.setSelectedSets(groupIds);
}
+ private void setHostComponentName(String idFather) {
+ Pair hostComponentName;
+ if (idFather != null && !idFather.equals("0")) {// je suis sur un ss-espace
+ SpaceInst spaceFather = getSpaceInstById(idFather);
+ hostComponentName = new Pair<>(spaceFather.getName() + " > " + getSpaceInstById().
+ getName(), null);
+ } else {
+ hostComponentName = new Pair<>(getSpaceInstById().getName(), null);
+ }
+ selection.setHostComponentName(hostComponentName);
+ }
+
public void updateSpaceRole(String role, List userIds, List groupIds) {
// Update the profile
SpaceInst spaceint1 = getSpaceInstById();
@@ -836,7 +827,7 @@ private LocalizedParameterList getUngroupedParameters(WAComponent component, boo
existingComponent = getComponentInst(getManagedInstanceId());
}
localized.add(0, createIsHiddenParam(component, existingComponent));
- if (JobStartPagePeasSettings.isPublicParameterEnable) {
+ if (JobStartPagePeasSettings.IS_PUBLIC_PARAMETER_ENABLED) {
localized.add(0, createIsPublicParam(component, existingComponent));
}
@@ -890,13 +881,13 @@ public String updateComponentInst(ComponentInst componentInst) {
return adminController.updateComponentInst(componentInst);
}
- public String deleteComponentInst(String sInstanceId) {
- boolean definitiveDelete = !JobStartPagePeasSettings.isBasketEnable;
- if (JobStartPagePeasSettings.isBasketEnable && isUserAdmin()) {
- definitiveDelete = !JobStartPagePeasSettings.useBasketWhenAdmin;
+ public void deleteComponentInst(String sInstanceId) {
+ boolean definitiveDelete = !JobStartPagePeasSettings.IS_BASKET_ENABLED;
+ if (JobStartPagePeasSettings.IS_BASKET_ENABLED && isUserAdmin()) {
+ definitiveDelete = !JobStartPagePeasSettings.USE_BASKET_WHEN_ADMIN;
}
- return adminController.deleteComponentInst(getUserDetail(), sInstanceId, definitiveDelete);
+ adminController.deleteComponentInst(getUserDetail(), sInstanceId, definitiveDelete);
}
// ArrayList de ProfileInst dont l'id est vide ou pas
@@ -1001,22 +992,15 @@ public void initUserPanelInstanceForGroupsUsers(String compoURL, List us
String hostSpaceName = getMultilang().getString("JSPP.manageHomePage");
selection.setHostSpaceName(hostSpaceName);
- Pair hostComponentName;
SpaceInst space = getSpaceInstById();
if (space != null) {
String idFather = space.getDomainFatherId();
- if (idFather != null && !idFather.equals("0")) {// je suis sur un ss-espace
- SpaceInst spaceFather = getSpaceInstById(idFather);
- hostComponentName = new Pair<>(spaceFather.getName() + " > " + getSpaceInstById().
- getName(), null);
- } else {
- hostComponentName = new Pair<>(getSpaceInstById().getName(), null);
- }
- selection.setHostComponentName(hostComponentName);
+ setHostComponentName(idFather);
}
LocalizationBundle generalMessage = ResourceLocator.getGeneralLocalizationBundle(getLanguage());
String compoName = getComponentInst(getManagedInstanceId()).getLabel();
+ @SuppressWarnings("unchecked")
Pair[] hostPath =
new Pair[]{new Pair<>(compoName + " > " + profile + " > " + generalMessage.
getString("GML.selection"), null)};
@@ -1056,12 +1040,6 @@ public void updateInstanceProfile(String[] userIds, String[] groupIds) {
setManagedProfile(profile);
}
- /**
- * Copy component
- *
- * @param id
- * @throws RemoteException
- */
public void copyComponent(String id) throws ClipboardException {
copyOrCutComponent(id, false);
}
@@ -1094,12 +1072,6 @@ private void copyOrCutSpace(String id, boolean cut) throws ClipboardException {
addClipboardSelection(spaceSelect);
}
- /**
- * Paste component(s) copied
- *
- * @throws ClipboardException
- * @throws JobStartPagePeasException
- */
public void paste(Map options) throws ClipboardException, JobStartPagePeasException {
checkAccessGranted(getManagedSpaceId(), getManagedInstanceId(), false);
try {
@@ -1145,7 +1117,7 @@ public void paste(Map options) throws ClipboardException, JobSta
/**
* Get names of all copied components directly or indirectly (case of a space)
* @return a Set of component names
- * @throws JobStartPagePeasException
+ * @throws JobStartPagePeasException if an error occurs while getting copied components
*/
public Set getCopiedComponents() throws JobStartPagePeasException {
Set copiedComponents = new HashSet<>();
@@ -1180,8 +1152,8 @@ public Set getCopiedComponents() throws JobStartPagePeasException {
/**
* Paste component with profiles
*
- * @param pasteDetail
- * @throws JobStartPagePeasException
+ * @param pasteDetail the detail about the component to paste.
+ * @throws JobStartPagePeasException if an error occurs while pasting the component.
*/
private void pasteComponent(PasteDetail pasteDetail) throws JobStartPagePeasException {
try {
@@ -1261,6 +1233,7 @@ public int getScope() {
public SilverpeasTemplate getSilverpeasTemplate() {
Properties configuration = new Properties(templateConfiguration);
SilverpeasTemplate template = SilverpeasTemplates.createSilverpeasTemplate(configuration);
+ template.setAttribute("communityEnabled", isCommunityEnabled());
return template;
}
@@ -1304,4 +1277,16 @@ private LocalizedParameter createIsPublicParam(final WAComponent descriptor, Com
publicParam.setWarning(warning);
return new LocalizedParameter(descriptor, publicParam, getLanguage());
}
+
+ public boolean isCommunityEnabled() {
+ return communityFactory != null && getSettings().getBoolean("UseCommunitySpace", false);
+ }
+
+ private CommunityFactory getCommunityFactory() {
+ try {
+ return ServiceProvider.getService(CommunityFactory.class);
+ } catch (Exception e) {
+ return null;
+ }
+ }
}
diff --git a/core-war/src/main/java/org/silverpeas/web/jobstartpage/servlets/JobStartPagePeasRequestRouter.java b/core-war/src/main/java/org/silverpeas/web/jobstartpage/servlets/JobStartPagePeasRequestRouter.java
index 6b24ac6976..82ed6d0c60 100644
--- a/core-war/src/main/java/org/silverpeas/web/jobstartpage/servlets/JobStartPagePeasRequestRouter.java
+++ b/core-war/src/main/java/org/silverpeas/web/jobstartpage/servlets/JobStartPagePeasRequestRouter.java
@@ -260,7 +260,7 @@ public String getDestinationComponent(String function,
} else if ("EffectiveCreateInstance".equals(function)) {
// Create the component
ComponentInst componentInst = new ComponentInst();
- request2ComponentInst(componentInst, request, jobStartPageSC);
+ requestToComponentInst(jobStartPageSC, request, componentInst);
SpaceInst spaceInst = jobStartPageSC.getSpaceInstById();
componentInst.setDomainFatherId(spaceInst.getId());
@@ -292,7 +292,7 @@ public String getDestinationComponent(String function,
} else if (function.equals("EffectiveUpdateInstance")) {
ComponentInst componentInst = jobStartPageSC.getComponentInst(jobStartPageSC.
getManagedInstanceId());
- request2ComponentInst(componentInst, request, jobStartPageSC);
+ requestToComponentInst(jobStartPageSC, request, componentInst);
// Update the instance
String componentId = jobStartPageSC.updateComponentInst(componentInst);
if (StringUtil.isDefined(componentId)) {
@@ -428,6 +428,7 @@ public String getDestinationSpace(String function,
if (START_PAGE_INFO_DEST.equals(function)) {
SpaceInst spaceInst = jobStartPageSC.getSpaceInstById();
+ request.setAttribute("communityEnabled", jobStartPageSC.isCommunityEnabled());
if (spaceInst == null) {
destination = getDestination(WELCOME_FCT, jobStartPageSC, request);
} else {
@@ -473,19 +474,22 @@ public String getDestinationSpace(String function,
request.setAttribute(URL_TO_RELOAD_ATTR,
START_PAGE_INFO_DEST + "?" + HAVE_TO_REFRESH_NAV_BAR_ATTR + "=true");
destination = CLOSE_WINDOW_FULL_DEST;
- } else if (function.equals("CreateSpace")) {
+ } else if (function.equals("CreateSpace") || function.equals("CreateCommunity")) {
+ boolean isSpaceCreation = function.equals("CreateSpace");
setSpaceNameInRequest(jobStartPageSC, request);
-
request.setAttribute(SUBSPACE_ATTR, request.getParameter(SUBSPACE_ATTR));
request.setAttribute(BROTHERS_ATTR, jobStartPageSC.getBrotherSpaces(true));
request.setAttribute(IS_USER_ADMIN_ATTR, jobStartPageSC.isUserAdmin());
+ request.setAttribute("inheritanceSupported", isSpaceCreation);
+ request.setAttribute("Action", isSpaceCreation ?
+ "EffectiveCreateSpace" : "EffectiveCreateCommunity");
destination = "/jobStartPagePeas/jsp/createSpace.jsp";
} else if (function.equals("EffectiveCreateSpace")) {
// Space CREATE action
SpaceInst newSpace = new SpaceInst();
- request2SpaceInst(newSpace, request);
- String spaceId = jobStartPageSC.createSpace(newSpace);
- if (spaceId != null && !spaceId.isEmpty()) {
+ requestToSpaceInst(request, newSpace);
+ boolean created = jobStartPageSC.createSpace(newSpace);
+ if (created) {
initQuotaData(newSpace, request, jobStartPageSC);
jobStartPageSC.setSpacePlace(request.getParameter("SpaceBefore"));
refreshNavBar(jobStartPageSC, request);
@@ -495,6 +499,23 @@ public String getDestinationSpace(String function,
setSpaceNameInRequest(jobStartPageSC, request);
destination = ERROR_FULL_DEST;
}
+ } else if (function.equals("EffectiveCreateCommunity")) {
+ // Space CREATE action
+ SpaceInst newSpace = new SpaceInst();
+ requestToSpaceInst(request, newSpace);
+ var communityApp = jobStartPageSC.createCommunitySpace(newSpace);
+ if (communityApp != null) {
+ initQuotaData(newSpace, request, jobStartPageSC);
+ jobStartPageSC.setSpacePlace(request.getParameter("SpaceBefore"));
+ jobStartPageSC.setManagedInstanceId(communityApp.getId());
+ jobStartPageSC.setComponentPlace("-1");
+ //refreshNavBar(jobStartPageSC, request);
+ destination = prepareUpdateInstance(jobStartPageSC, request);
+ } else {
+ request.setAttribute("When", "SpaceCreation");
+ setSpaceNameInRequest(jobStartPageSC, request);
+ destination = ERROR_FULL_DEST;
+ }
} else if (function.equals("UpdateSpace")) {
String translation = request.getParameter("Translation");
SpaceInst spaceInst = jobStartPageSC.getSpaceInstById();
@@ -502,14 +523,15 @@ public String getDestinationSpace(String function,
request.setAttribute(SPACE_TYPE, spaceInst);
request.setAttribute("Translation", translation);
request.setAttribute(IS_USER_ADMIN_ATTR, jobStartPageSC.isUserAdmin());
+ request.setAttribute("inheritanceSupported", !spaceInst.isCommunitySpace());
destination = "/jobStartPagePeas/jsp/updateSpace.jsp";
} else if (function.equals("EffectiveUpdateSpace")) {
// Update the space
SpaceInst spaceInst = jobStartPageSC.getSpaceInstById();
- request2SpaceInst(spaceInst, request);
- String spaceId = jobStartPageSC.updateSpaceInst(spaceInst);
- if (spaceId != null && !spaceId.isEmpty()) {
+ requestToSpaceInst(request, spaceInst);
+ boolean updated = jobStartPageSC.updateSpaceInst(spaceInst);
+ if (updated) {
initQuotaData(spaceInst, request, jobStartPageSC);
refreshNavBar(jobStartPageSC, request);
destination = getDestinationSpace(START_PAGE_INFO_DEST, jobStartPageSC, request);
@@ -563,7 +585,7 @@ public String getDestinationSpace(String function,
if (SilverpeasRole.MANAGER == SilverpeasRole.fromString(role)) {
request.setAttribute(INHERITANCE_ATTR, true);
} else {
- request.setAttribute(INHERITANCE_ATTR, JobStartPagePeasSettings.isInheritanceEnable);
+ request.setAttribute(INHERITANCE_ATTR, JobStartPagePeasSettings.IS_INHERITANCE_ENABLED);
}
destination = "/jobStartPagePeas/jsp/spaceManager.jsp";
@@ -573,8 +595,7 @@ public String getDestinationSpace(String function,
List groupIds = (List) StringUtil
.splitString(request.getParameter(USER_PANEL_CURRENT_GROUP_IDS_PARAM), ',');
jobStartPageSC
- .initUserPanelSpaceForGroupsUsers((String) request.getAttribute("myComponentURL"),
- userIds, groupIds);
+ .initUserPanelSpaceForGroupsUsers(userIds, groupIds);
destination = Selection.getSelectionURL();
} else if (function.equals("EffectiveSetSpaceProfile")) {
String role = request.getParameter("Role");
@@ -591,7 +612,7 @@ public String getDestinationSpace(String function,
request.setAttribute(SPACE_TYPE, spaceInst);
request.setAttribute("SpaceLookHelper", jobStartPageSC.getSpaceLookHelper());
request.setAttribute(SPACE_EXTRA_INFOS_ATTR, jobStartPageSC.getManagedSpace());
- request.setAttribute(INHERITANCE_ATTR, JobStartPagePeasSettings.isInheritanceEnable);
+ request.setAttribute(INHERITANCE_ATTR, JobStartPagePeasSettings.IS_INHERITANCE_ENABLED);
setSpaceInfosInRequest(spaceInst, jobStartPageSC, request);
@@ -633,6 +654,14 @@ public String getDestinationSpace(String function,
return destination;
}
+ private int asInt(String integerValue) {
+ return StringUtil.isDefined(integerValue) ? Integer.parseInt(integerValue) : -1;
+ }
+
+ private long asLong(String longValue) {
+ return StringUtil.isDefined(longValue) ? Long.parseLong(longValue) : -1;
+ }
+
@Override
public String getAdminDestination(String function, JobStartPagePeasSessionController jobStartPageSC,
HttpRequest request) {
@@ -675,7 +704,7 @@ public String getAdminDestination(String function, JobStartPagePeasSessionContro
request.setAttribute(IS_USER_ADMIN_ATTR, jobStartPageSC.isUserAdmin());
request.setAttribute("globalMode", jobStartPageSC.isAppInMaintenance());
request.setAttribute("IsBackupEnable", jobStartPageSC.isBackupEnable());
- request.setAttribute("IsBasketEnable", JobStartPagePeasSettings.isBasketEnable);
+ request.setAttribute("IsBasketEnable", JobStartPagePeasSettings.IS_BASKET_ENABLED);
break;
case START_PAGE_INFO_FULL_DEST:
SpaceInst spaceInst = jobStartPageSC.getSpaceInstById();
@@ -692,7 +721,7 @@ public String getAdminDestination(String function, JobStartPagePeasSessionContro
request.setAttribute(SPACE_EXTRA_INFOS_ATTR, jobStartPageSC.getManagedSpace());
request.setAttribute("IsBackupEnable", jobStartPageSC.isBackupEnable());
- request.setAttribute(INHERITANCE_ATTR, JobStartPagePeasSettings.isInheritanceEnable);
+ request.setAttribute(INHERITANCE_ATTR, JobStartPagePeasSettings.IS_INHERITANCE_ENABLED);
request.setAttribute("CopiedComponents", jobStartPageSC.getCopiedComponents());
@@ -722,7 +751,7 @@ public String getAdminDestination(String function, JobStartPagePeasSessionContro
getAllUsers()));
}
request.setAttribute("ProfileEditable", jobStartPageSC.isProfileEditable());
- request.setAttribute(INHERITANCE_ATTR, JobStartPagePeasSettings.isInheritanceEnable);
+ request.setAttribute(INHERITANCE_ATTR, JobStartPagePeasSettings.IS_INHERITANCE_ENABLED);
String profileHelp = jobStartPageSC.getManagedProfileHelp(componentInst.getName());
request.setAttribute("ProfileHelp", profileHelp);
@@ -760,7 +789,7 @@ private void setSpaceInfosInRequest(SpaceInst spaceInst,
}
}
- private void request2SpaceInst(SpaceInst spaceInst, HttpServletRequest request) {
+ private void requestToSpaceInst(HttpServletRequest request, SpaceInst spaceInst) {
String name = request.getParameter("NameObject");
String desc = request.getParameter("Description");
String pInheritance = request.getParameter("InheritanceBlocked");
@@ -784,19 +813,18 @@ private void initQuotaData(SpaceInst spaceInst, HttpServletRequest request,
JobStartPagePeasSessionController jobStartPageSC) {
String componentSpaceQuotaMaxCount = request.getParameter("ComponentSpaceQuota");
String dataStorageQuotaMaxCount = request.getParameter("DataStorageQuota");
- jobStartPageSC.saveSpaceQuota(spaceInst, componentSpaceQuotaMaxCount,
- dataStorageQuotaMaxCount);
+ jobStartPageSC.saveSpaceQuota(spaceInst, asInt(componentSpaceQuotaMaxCount),
+ asLong(dataStorageQuotaMaxCount));
}
- private void request2ComponentInst(ComponentInst componentInst,
- HttpServletRequest request,
- JobStartPagePeasSessionController jobStartPageSC) {
+ private void requestToComponentInst(JobStartPagePeasSessionController jobStartPageSC,
+ HttpServletRequest request, ComponentInst componentInst) {
String name = request.getParameter("NameObject");
String desc = request.getParameter("Description");
if (desc == null) {
desc = "";
}
- if (JobStartPagePeasSettings.isPublicParameterEnable) {
+ if (JobStartPagePeasSettings.IS_PUBLIC_PARAMETER_ENABLED) {
String pPublic = request.getParameter("PublicComponent");
componentInst.setPublic(StringUtil.isDefined(pPublic));
} else {
@@ -880,7 +908,7 @@ private void prepareDisplayComponentInfo(JobStartPagePeasSessionController sessi
request.setAttribute(COMPONENT_INST_ATTR, componentInst);
request.setAttribute("JobPeas", waComponent);
request.setAttribute(PROFILES_ATTR, sessionController.getAllProfiles(componentInst));
- request.setAttribute(INHERITANCE_ATTR, JobStartPagePeasSettings.isInheritanceEnable);
+ request.setAttribute(INHERITANCE_ATTR, JobStartPagePeasSettings.IS_INHERITANCE_ENABLED);
request.setAttribute("MaintenanceState", sessionController.getCurrentSpaceMaintenanceState());
request.setAttribute(SCOPE_ATTR, sessionController.getScope());
}
diff --git a/core-war/src/main/java/org/silverpeas/web/look/AjaxServletLookV5.java b/core-war/src/main/java/org/silverpeas/web/look/AjaxServletLookV5.java
index b33e652cd6..b03b2c7783 100644
--- a/core-war/src/main/java/org/silverpeas/web/look/AjaxServletLookV5.java
+++ b/core-war/src/main/java/org/silverpeas/web/look/AjaxServletLookV5.java
@@ -812,14 +812,14 @@ protected boolean isSpaceVisible(String userId, SpaceInstLight space, LookHelper
protected boolean isSpaceBeforeComponentNeeded(SpaceInstLight space) {
// Display computing : First look at global configuration
- if (JobStartPagePeasSettings.SPACEDISPLAYPOSITION_CONFIG
- .equalsIgnoreCase(JobStartPagePeasSettings.SPACEDISPLAYPOSITION_BEFORE)) {
+ if (JobStartPagePeasSettings.SPACE_DISPLAY_POSITION_CONFIG
+ .equalsIgnoreCase(JobStartPagePeasSettings.SPACE_DISPLAY_POSITION_BEFORE)) {
return true;
- } else if (JobStartPagePeasSettings.SPACEDISPLAYPOSITION_CONFIG
- .equalsIgnoreCase(JobStartPagePeasSettings.SPACEDISPLAYPOSITION_AFTER)) {
+ } else if (JobStartPagePeasSettings.SPACE_DISPLAY_POSITION_CONFIG
+ .equalsIgnoreCase(JobStartPagePeasSettings.SPACE_DISPLAY_POSITION_AFTER)) {
return false;
- } else if (JobStartPagePeasSettings.SPACEDISPLAYPOSITION_CONFIG
- .equalsIgnoreCase(JobStartPagePeasSettings.SPACEDISPLAYPOSITION_TODEFINE)) {
+ } else if (JobStartPagePeasSettings.SPACE_DISPLAY_POSITION_CONFIG
+ .equalsIgnoreCase(JobStartPagePeasSettings.SPACE_DISPLAY_POSITION_TODEFINE)) {
return space.isDisplaySpaceFirst();
}
return true;
diff --git a/core-war/src/main/webapp/jobDomainPeas/jsp/domainContent.jsp b/core-war/src/main/webapp/jobDomainPeas/jsp/domainContent.jsp
index 6e53e4be81..2e74fb0bec 100644
--- a/core-war/src/main/webapp/jobDomainPeas/jsp/domainContent.jsp
+++ b/core-war/src/main/webapp/jobDomainPeas/jsp/domainContent.jsp
@@ -65,6 +65,7 @@
boolean isUserAddingAllowed = (Boolean)request.getAttribute("isUserAddingAllowedForGroupManager");
boolean groupInClipboard = (Boolean) request.getAttribute("groupInClipboard");
Group[] subGroups = (Group[])request.getAttribute("subGroups");
+ Group[] appGroups = (Group[])request.getAttribute("appGroups");
//noinspection unchecked
List subUsers = (List)request.getAttribute("subUsers");
@@ -77,7 +78,7 @@
browseBar.setComponentName(getDomainLabel(domObject, resource), "domainContent?Iddomain="+domObject.getId());
// Initializing users in domain quota
- boolean isUserDomainQuotaFull = JobDomainSettings.usersInDomainQuotaActivated && domObject.isQuotaReached();
+ boolean isUserDomainQuotaFull = JobDomainSettings.isUsersInDomainQuotaEnabled() && domObject.isQuotaReached();
// Domain operations
operationPane.addOperation(resource.getIcon("JDP.userPanelAccess"),userPanelAccessLabel,"displaySelectUserOrGroup");
@@ -188,6 +189,7 @@
+
@@ -247,7 +249,7 @@ out.println(window.printBefore());
- <% if (JobDomainSettings.usersInDomainQuotaActivated &&
+ <% if (JobDomainSettings.isUsersInDomainQuotaEnabled() &&
!QuotaLoad.UNLIMITED.equals(domObject.getUserDomainQuota().getLoad())) { %>