diff --git a/ccm-core/src/main/java/com/arsdigita/util/SystemInformation.java b/ccm-core/src/main/java/com/arsdigita/util/SystemInformation.java index 7605f7e36..7600ffeef 100644 --- a/ccm-core/src/main/java/com/arsdigita/util/SystemInformation.java +++ b/ccm-core/src/main/java/com/arsdigita/util/SystemInformation.java @@ -53,7 +53,6 @@ import java.util.stream.Stream; * * * @author Jens Pelzetter - * @version $Id$ */ public class SystemInformation { diff --git a/ccm-core/src/main/java/org/libreccm/api/admin/AdminApi.java b/ccm-core/src/main/java/org/libreccm/api/admin/AdminApi.java index 8a6307346..e954ec9f7 100644 --- a/ccm-core/src/main/java/org/libreccm/api/admin/AdminApi.java +++ b/ccm-core/src/main/java/org/libreccm/api/admin/AdminApi.java @@ -44,6 +44,9 @@ public class AdminApi extends Application { classes.add(GroupsApi.class); classes.add(RolesApi.class); classes.add(UsersApi.class); + + // System Information API + classes.add(SystemInformationApi.class); return classes; } diff --git a/ccm-core/src/main/java/org/libreccm/api/admin/SystemInformationApi.java b/ccm-core/src/main/java/org/libreccm/api/admin/SystemInformationApi.java new file mode 100644 index 000000000..e0ba829be --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/api/admin/SystemInformationApi.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2020 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.libreccm.api.admin; + +import com.arsdigita.util.SystemInformation; + +import org.libreccm.core.CoreConstants; +import org.libreccm.security.AuthorizationRequired; +import org.libreccm.security.RequiresPrivilege; + +import javax.enterprise.context.RequestScoped; +import javax.transaction.Transactional; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +/** + * + * @author Jens Pelzetter + */ +@RequestScoped +@Path("/systeminformation") +public class SystemInformationApi { + + @GET + @Path("/{domainIdentifier}/{path:^[\\w\\-/]+$}") + @Produces(MediaType.APPLICATION_JSON) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + @Transactional(Transactional.TxType.REQUIRED) + public SystemInformation getSystemInformation() { + return SystemInformation.getInstance(); + } + +}