You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2021/10/18 20:21:23 UTC

[incubator-streampipes] branch STREAMPIPES-426 updated: Add new module to centralize management of resources

This is an automated email from the ASF dual-hosted git repository.

riemer pushed a commit to branch STREAMPIPES-426
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git


The following commit(s) were added to refs/heads/STREAMPIPES-426 by this push:
     new 2f74886  Add new module to centralize management of resources
2f74886 is described below

commit 2f748868c00cebbaa21d9d984b16e3a599de07f2
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Mon Oct 18 22:21:14 2021 +0200

    Add new module to centralize management of resources
---
 pom.xml                                            |   1 +
 .../backend/StreamPipesBackendApplication.java     |   2 +-
 .../backend/StreamPipesResourceConfig.java         |   8 +-
 streampipes-pipeline-management/pom.xml            |   5 +
 streampipes-resource-management/pom.xml            |  22 ++++
 .../management/AbstractResourceManager.java        |  18 +--
 .../management/AdapterResourceManager.java         |  18 +--
 .../management/DashboardResourceManager.java       |  18 +--
 .../management/DataExplorerResourceManager.java    |  18 +--
 .../management/PipelineElementResourceManager.java |  18 +--
 .../management/PipelineResourceManager.java        |  18 +--
 .../resource/management/SpResourceManager.java     |  28 +++--
 .../streampipes/rest/api/IPipelineElement.java     |   4 -
 .../rest/authentication/StreamPipesFilter.java     |  55 ---------
 ...tDashboard.java => AssetDashboardResource.java} |   2 +-
 .../rest/impl/InternalPipelineTemplates.java       | 131 ---------------------
 .../rest/impl/OntologyPipelineElement.java         | 122 -------------------
 .../streampipes/rest/impl/PipelineResource.java    |  18 +--
 .../rest/impl/SemanticEventConsumer.java           |  32 -----
 .../rest/impl/SemanticEventProcessingAgent.java    |  32 -----
 .../rest/impl/SemanticEventProducer.java           |  32 -----
 .../org/apache/streampipes/rest/impl/Setup.java    |  24 ----
 .../rest/impl/{ => admin}/ConsulConfig.java        |  28 +++--
 .../impl/admin/EmailConfigurationResource.java     |   5 +
 .../rest/impl/{ => admin}/UserGroupResource.java   |   8 +-
 .../rest/impl/nouser/PipelineNoUserResource.java   |  50 --------
 .../rest/management/PipelineManagement.java        |  46 --------
 .../rest/{impl => }/security/AuthConstants.java    |   5 +-
 .../{impl => }/security/SpPermissionEvaluator.java |   2 +-
 29 files changed, 104 insertions(+), 666 deletions(-)

diff --git a/pom.xml b/pom.xml
index 4811e0a..625b419 100644
--- a/pom.xml
+++ b/pom.xml
@@ -895,6 +895,7 @@
         <module>streampipes-wrapper-spark</module>
         <module>streampipes-wrapper-standalone</module>
         <module>streampipes-mail</module>
+        <module>streampipes-resource-management</module>
     </modules>
 
     <profiles>
diff --git a/streampipes-backend/src/main/java/org/apache/streampipes/backend/StreamPipesBackendApplication.java b/streampipes-backend/src/main/java/org/apache/streampipes/backend/StreamPipesBackendApplication.java
index 844bad1..af97e1d 100644
--- a/streampipes-backend/src/main/java/org/apache/streampipes/backend/StreamPipesBackendApplication.java
+++ b/streampipes-backend/src/main/java/org/apache/streampipes/backend/StreamPipesBackendApplication.java
@@ -25,7 +25,7 @@ import org.apache.streampipes.manager.operations.Operations;
 import org.apache.streampipes.manager.setup.AutoInstallation;
 import org.apache.streampipes.model.pipeline.Pipeline;
 import org.apache.streampipes.model.pipeline.PipelineOperationStatus;
-import org.apache.streampipes.rest.impl.security.SpPermissionEvaluator;
+import org.apache.streampipes.rest.security.SpPermissionEvaluator;
 import org.apache.streampipes.rest.notifications.NotificationListener;
 import org.apache.streampipes.storage.api.IPipelineStorage;
 import org.apache.streampipes.storage.management.StorageDispatcher;
diff --git a/streampipes-backend/src/main/java/org/apache/streampipes/backend/StreamPipesResourceConfig.java b/streampipes-backend/src/main/java/org/apache/streampipes/backend/StreamPipesResourceConfig.java
index afa10bc..7ae8e19 100644
--- a/streampipes-backend/src/main/java/org/apache/streampipes/backend/StreamPipesResourceConfig.java
+++ b/streampipes-backend/src/main/java/org/apache/streampipes/backend/StreamPipesResourceConfig.java
@@ -23,7 +23,9 @@ import org.apache.streampipes.ps.DataLakeResourceV3;
 import org.apache.streampipes.ps.DataLakeResourceV4;
 import org.apache.streampipes.ps.PipelineElementTemplateResource;
 import org.apache.streampipes.rest.impl.*;
+import org.apache.streampipes.rest.impl.admin.ConsulConfig;
 import org.apache.streampipes.rest.impl.admin.EmailConfigurationResource;
+import org.apache.streampipes.rest.impl.admin.UserGroupResource;
 import org.apache.streampipes.rest.impl.connect.*;
 import org.apache.streampipes.rest.impl.dashboard.Dashboard;
 import org.apache.streampipes.rest.impl.dashboard.DashboardWidget;
@@ -34,7 +36,6 @@ import org.apache.streampipes.rest.impl.datalake.DataLakeWidgetResource;
 import org.apache.streampipes.rest.impl.datalake.PersistedDataStreamResource;
 import org.apache.streampipes.rest.impl.nouser.FileServingResource;
 import org.apache.streampipes.rest.impl.nouser.PipelineElementImportNoUser;
-import org.apache.streampipes.rest.impl.nouser.PipelineNoUserResource;
 import org.apache.streampipes.rest.shared.serializer.GsonClientModelProvider;
 import org.apache.streampipes.rest.shared.serializer.GsonWithIdProvider;
 import org.apache.streampipes.rest.shared.serializer.GsonWithoutIdProvider;
@@ -53,7 +54,7 @@ public class StreamPipesResourceConfig extends ResourceConfig {
     public StreamPipesResourceConfig() {
         setProperties(Collections.singletonMap("jersey.config.server.response.setStatusOverSendError", true));
         register(Authentication.class);
-        register(AssetDashboard.class);
+        register(AssetDashboardResource.class);
         register(AutoComplete.class);
         register(CategoryResource.class);
         register(ConsulConfig.class);
@@ -68,12 +69,10 @@ public class StreamPipesResourceConfig extends ResourceConfig {
         register(EmailResource.class);
         register(ExtensionsServiceEndpointResource.class);
         register(FileServingResource.class);
-        register(InternalPipelineTemplates.class);
         register(LabelResource.class);
         register(MeasurementUnitResource.class);
         register(Notification.class);
         register(OntologyMeasurementUnit.class);
-        register(OntologyPipelineElement.class);
         register(PersistedDataStreamResource.class);
         register(PipelineCanvasMetadataCache.class);
         register(PipelineCanvasMetadataResource.class);
@@ -87,7 +86,6 @@ public class StreamPipesResourceConfig extends ResourceConfig {
         register(PipelineElementPreview.class);
         register(PipelineElementRuntimeInfo.class);
         register(PipelineMonitoring.class);
-        register(PipelineNoUserResource.class);
         register(PipelineTemplate.class);
         register(PipelineResource.class);
         register(SemanticEventConsumer.class);
diff --git a/streampipes-pipeline-management/pom.xml b/streampipes-pipeline-management/pom.xml
index 89f6294..3eb1f21 100644
--- a/streampipes-pipeline-management/pom.xml
+++ b/streampipes-pipeline-management/pom.xml
@@ -89,6 +89,11 @@
         </dependency>
         <dependency>
             <groupId>org.apache.streampipes</groupId>
+            <artifactId>streampipes-resource-management</artifactId>
+            <version>0.69.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.streampipes</groupId>
             <artifactId>streampipes-sdk</artifactId>
             <version>0.69.0-SNAPSHOT</version>
         </dependency>
diff --git a/streampipes-resource-management/pom.xml b/streampipes-resource-management/pom.xml
new file mode 100644
index 0000000..0cb9b20
--- /dev/null
+++ b/streampipes-resource-management/pom.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>streampipes-parent</artifactId>
+        <groupId>org.apache.streampipes</groupId>
+        <version>0.69.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>streampipes-resource-management</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.streampipes</groupId>
+            <artifactId>streampipes-storage-management</artifactId>
+            <version>0.69.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+</project>
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/filter/LoggingFilter.java b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/AbstractResourceManager.java
similarity index 70%
copy from streampipes-rest/src/main/java/org/apache/streampipes/rest/filter/LoggingFilter.java
copy to streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/AbstractResourceManager.java
index aaa4870..de7609b 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/filter/LoggingFilter.java
+++ b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/AbstractResourceManager.java
@@ -15,21 +15,7 @@
  * limitations under the License.
  *
  */
+package org.apache.streampipes.resource.management;
 
-package org.apache.streampipes.rest.filter;
-
-import java.io.IOException;
-
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.container.ContainerRequestFilter;
-
-
-
-public class LoggingFilter implements ContainerRequestFilter {
-
-	@Override
-	public void filter(ContainerRequestContext request) throws IOException {
-		
-	}
-
+public class AbstractResourceManager {
 }
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/interceptor/AuthenticationInterceptor.java b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/AdapterResourceManager.java
similarity index 58%
copy from streampipes-rest/src/main/java/org/apache/streampipes/rest/interceptor/AuthenticationInterceptor.java
copy to streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/AdapterResourceManager.java
index c2a091d..af2299c 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/interceptor/AuthenticationInterceptor.java
+++ b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/AdapterResourceManager.java
@@ -15,21 +15,7 @@
  * limitations under the License.
  *
  */
-package org.apache.streampipes.rest.interceptor;
+package org.apache.streampipes.resource.management;
 
-import org.apache.streampipes.rest.shared.annotation.NoAuthenticationRequired;
-
-import javax.ws.rs.container.DynamicFeature;
-import javax.ws.rs.container.ResourceInfo;
-import javax.ws.rs.core.FeatureContext;
-
-public class AuthenticationInterceptor implements DynamicFeature {
-
-
-  @Override
-  public void configure(ResourceInfo resourceInfo, FeatureContext context) {
-    if (!resourceInfo.getResourceMethod().isAnnotationPresent(NoAuthenticationRequired.class)) {
-      //context.register(StreamPipesFilter.class);
-    }
-  }
+public class AdapterResourceManager {
 }
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/filter/LoggingFilter.java b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/DashboardResourceManager.java
similarity index 70%
copy from streampipes-rest/src/main/java/org/apache/streampipes/rest/filter/LoggingFilter.java
copy to streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/DashboardResourceManager.java
index aaa4870..0debe0c 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/filter/LoggingFilter.java
+++ b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/DashboardResourceManager.java
@@ -15,21 +15,7 @@
  * limitations under the License.
  *
  */
+package org.apache.streampipes.resource.management;
 
-package org.apache.streampipes.rest.filter;
-
-import java.io.IOException;
-
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.container.ContainerRequestFilter;
-
-
-
-public class LoggingFilter implements ContainerRequestFilter {
-
-	@Override
-	public void filter(ContainerRequestContext request) throws IOException {
-		
-	}
-
+public class DashboardResourceManager {
 }
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/filter/LoggingFilter.java b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/DataExplorerResourceManager.java
similarity index 70%
copy from streampipes-rest/src/main/java/org/apache/streampipes/rest/filter/LoggingFilter.java
copy to streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/DataExplorerResourceManager.java
index aaa4870..24cb5f5 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/filter/LoggingFilter.java
+++ b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/DataExplorerResourceManager.java
@@ -15,21 +15,7 @@
  * limitations under the License.
  *
  */
+package org.apache.streampipes.resource.management;
 
-package org.apache.streampipes.rest.filter;
-
-import java.io.IOException;
-
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.container.ContainerRequestFilter;
-
-
-
-public class LoggingFilter implements ContainerRequestFilter {
-
-	@Override
-	public void filter(ContainerRequestContext request) throws IOException {
-		
-	}
-
+public class DataExplorerResourceManager {
 }
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/filter/LoggingFilter.java b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/PipelineElementResourceManager.java
similarity index 70%
copy from streampipes-rest/src/main/java/org/apache/streampipes/rest/filter/LoggingFilter.java
copy to streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/PipelineElementResourceManager.java
index aaa4870..c804719 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/filter/LoggingFilter.java
+++ b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/PipelineElementResourceManager.java
@@ -15,21 +15,7 @@
  * limitations under the License.
  *
  */
+package org.apache.streampipes.resource.management;
 
-package org.apache.streampipes.rest.filter;
-
-import java.io.IOException;
-
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.container.ContainerRequestFilter;
-
-
-
-public class LoggingFilter implements ContainerRequestFilter {
-
-	@Override
-	public void filter(ContainerRequestContext request) throws IOException {
-		
-	}
-
+public class PipelineElementResourceManager {
 }
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/filter/LoggingFilter.java b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/PipelineResourceManager.java
similarity index 70%
rename from streampipes-rest/src/main/java/org/apache/streampipes/rest/filter/LoggingFilter.java
rename to streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/PipelineResourceManager.java
index aaa4870..21692f9 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/filter/LoggingFilter.java
+++ b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/PipelineResourceManager.java
@@ -15,21 +15,7 @@
  * limitations under the License.
  *
  */
+package org.apache.streampipes.resource.management;
 
-package org.apache.streampipes.rest.filter;
-
-import java.io.IOException;
-
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.container.ContainerRequestFilter;
-
-
-
-public class LoggingFilter implements ContainerRequestFilter {
-
-	@Override
-	public void filter(ContainerRequestContext request) throws IOException {
-		
-	}
-
+public class PipelineResourceManager {
 }
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/interceptor/AuthenticationInterceptor.java b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/SpResourceManager.java
similarity index 57%
rename from streampipes-rest/src/main/java/org/apache/streampipes/rest/interceptor/AuthenticationInterceptor.java
rename to streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/SpResourceManager.java
index c2a091d..88e56f2 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/interceptor/AuthenticationInterceptor.java
+++ b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/SpResourceManager.java
@@ -15,21 +15,27 @@
  * limitations under the License.
  *
  */
-package org.apache.streampipes.rest.interceptor;
+package org.apache.streampipes.resource.management;
 
-import org.apache.streampipes.rest.shared.annotation.NoAuthenticationRequired;
+public class SpResourceManager {
 
-import javax.ws.rs.container.DynamicFeature;
-import javax.ws.rs.container.ResourceInfo;
-import javax.ws.rs.core.FeatureContext;
+  public AdapterResourceManager manageAdapters() {
+    return new AdapterResourceManager();
+  }
 
-public class AuthenticationInterceptor implements DynamicFeature {
+  public DashboardResourceManager manageDashboards() {
+    return new DashboardResourceManager();
+  }
 
+  public DataExplorerResourceManager manageDataExplorer() {
+    return new DataExplorerResourceManager();
+  }
+
+  public PipelineElementResourceManager managePipelineElements() {
+    return new PipelineElementResourceManager();
+  }
 
-  @Override
-  public void configure(ResourceInfo resourceInfo, FeatureContext context) {
-    if (!resourceInfo.getResourceMethod().isAnnotationPresent(NoAuthenticationRequired.class)) {
-      //context.register(StreamPipesFilter.class);
-    }
+  public PipelineResourceManager managePipelines() {
+    return new PipelineResourceManager();
   }
 }
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/api/IPipelineElement.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/api/IPipelineElement.java
index 0c0cffa..3a55818 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/api/IPipelineElement.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/api/IPipelineElement.java
@@ -24,12 +24,8 @@ import javax.ws.rs.core.Response;
 public interface IPipelineElement {
 
 	Response getAvailable();
-	Response getFavorites();
 	Response getOwn();
 
-	Response addFavorite(String elementUri);
-
-	Response removeFavorite(String elementUri);
 	Response removeOwn(String elementUri);
 
 	Response getElement(String elementUri);
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/authentication/StreamPipesFilter.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/authentication/StreamPipesFilter.java
deleted file mode 100644
index f1e7c8e..0000000
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/authentication/StreamPipesFilter.java
+++ /dev/null
@@ -1,55 +0,0 @@
-///*
-// * Licensed to the Apache Software Foundation (ASF) under one or more
-// * contributor license agreements.  See the NOTICE file distributed with
-// * this work for additional information regarding copyright ownership.
-// * The ASF licenses this file to You under the Apache License, Version 2.0
-// * (the "License"); you may not use this file except in compliance with
-// * the License.  You may obtain a copy of the License at
-// *
-// *    http://www.apache.org/licenses/LICENSE-2.0
-// *
-// * Unless required by applicable law or agreed to in writing, software
-// * distributed under the License is distributed on an "AS IS" BASIS,
-// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// * See the License for the specific language governing permissions and
-// * limitations under the License.
-// *
-// */
-//
-//package org.apache.streampipes.rest.authentication;
-//
-//import org.apache.shiro.web.filter.authc.UserFilter;
-//import org.apache.shiro.web.util.WebUtils;
-//
-//import javax.servlet.ServletRequest;
-//import javax.servlet.ServletResponse;
-//import javax.servlet.http.HttpServletResponse;
-//
-///**
-// *
-// * Requires the requesting user to be authenticated for the request to continue and if they are not,
-// * responds with HTML Error code 403.
-// *
-// * See https://stackoverflow.com/questions/30344441/shiro-filter-without-redirect/30344953#30344953
-// *
-// */
-//
-//public class StreamPipesFilter extends UserFilter {
-//    private static final String message = "Access denied!";
-//
-//    @Override
-//    protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception {
-//        HttpServletResponse httpResponse ;
-//        try { httpResponse = WebUtils.toHttp(response); }
-//
-//        catch (ClassCastException ex) {
-//            // Not a HTTP Servlet operation
-//            return super.onAccessDenied(request, response) ;
-//        }
-//        if ( message == null )
-//            httpResponse.sendError(403) ;
-//        else
-//            httpResponse.sendError(403, message) ;
-//        return false ;
-//    }
-//}
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AssetDashboard.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AssetDashboardResource.java
similarity index 98%
rename from streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AssetDashboard.java
rename to streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AssetDashboardResource.java
index bc00199..5fa37a7 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AssetDashboard.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AssetDashboardResource.java
@@ -37,7 +37,7 @@ import java.nio.file.Files;
 import java.nio.file.Paths;
 
 @Path("/v2/asset-dashboards")
-public class AssetDashboard extends AbstractRestResource {
+public class AssetDashboardResource extends AbstractRestResource {
 
   private static final String APP_ID = "org.apache.streampipes.apps.assetdashboard";
 
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/InternalPipelineTemplates.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/InternalPipelineTemplates.java
deleted file mode 100644
index d9aec41..0000000
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/InternalPipelineTemplates.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.streampipes.rest.impl;
-
-import org.apache.streampipes.manager.operations.Operations;
-import org.apache.streampipes.model.SpDataStream;
-import org.apache.streampipes.model.graph.DataProcessorDescription;
-import org.apache.streampipes.model.graph.DataSinkDescription;
-import org.apache.streampipes.model.pipeline.PipelineOperationStatus;
-import org.apache.streampipes.model.template.PipelineTemplateDescription;
-import org.apache.streampipes.model.template.PipelineTemplateInvocation;
-import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource;
-import org.apache.streampipes.sdk.builder.BoundPipelineElementBuilder;
-import org.apache.streampipes.sdk.builder.PipelineTemplateBuilder;
-import org.apache.streampipes.storage.api.IPipelineElementDescriptionStorage;
-import org.apache.streampipes.storage.management.StorageDispatcher;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.net.URISyntaxException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@Path("/v2/internal-pipelines")
-public class InternalPipelineTemplates extends AbstractAuthGuardedRestResource {
-
-    private static final Logger LOG = LoggerFactory.getLogger(InternalPipelineTemplates.class);
-    private Map<String, Template> templates;
-
-    public InternalPipelineTemplates() {
-        templates = new HashMap<>();
-        templates.put("Save Logs", new Template() {
-            @Override
-            public PipelineTemplateDescription makeTemplate() throws URISyntaxException {
-                return new PipelineTemplateDescription(PipelineTemplateBuilder.create("logs-to-Elastic", "Save Logs", "Save all logs in Elastic-Search")
-                        .boundPipelineElementTemplate(BoundPipelineElementBuilder
-                                .create(getSink("org.apache.streampipes.pe.flink.elasticsearch"))
-                                .withPredefinedFreeTextValue("index-name", "streampipes-log")
-                                .withPredefinedSelection("timestamp", Collections.singletonList("epochTime"))
-                                .build())
-                        .build());
-            }
-        });
-    }
-
-    @GET
-    @Produces(MediaType.APPLICATION_JSON)
-    //Returns all log-pipeline Invocations
-    public Response getPipelineTemplateInvocation() {
-        Object[] templateNames = templates.keySet().toArray();
-        String templateJSON = toJson(templateNames);
-        return ok(templateJSON);
-
-    }
-
-    @POST
-    @Produces(MediaType.APPLICATION_JSON)
-    public Response generatePipeline(String pipelineId) {
-        try {
-            PipelineTemplateDescription pipelineTemplateDescription = templates.get(pipelineId).makeTemplate();
-
-            PipelineTemplateInvocation invocation = Operations.getPipelineInvocationTemplate(getLogDataStream(), pipelineTemplateDescription);
-            PipelineOperationStatus status = Operations.handlePipelineTemplateInvocation(getAuthenticatedUsername(), invocation, pipelineTemplateDescription);
-
-            return ok(status);
-        } catch (URISyntaxException e) {
-            e.printStackTrace();
-            return fail();
-        }
-    }
-
-    private DataProcessorDescription getProcessor(String id) throws URISyntaxException {
-        return getStorage()
-                .getDataProcessorById(id);
-    }
-
-    private DataSinkDescription getSink(String id) throws URISyntaxException {
-        return getStorage()
-                .getDataSinkByAppId(id);
-    }
-
-    private IPipelineElementDescriptionStorage getStorage() {
-        return StorageDispatcher
-                .INSTANCE
-                .getNoSqlStore()
-                .getPipelineElementDescriptionStorage();
-    }
-
-    private List<SpDataStream> getAllDataStreams() {
-        return getPipelineElementRdfStorage().getAllDataStreams();
-    }
-
-    private SpDataStream getLogDataStream() {
-        return new SpDataStream(getAllDataStreams()
-                .stream()
-                .filter(sp -> sp.getAppId() != null)
-                .filter(sp -> sp.getAppId().equals("org.apache.streampipes.sources.log.stream"))
-                .findFirst()
-                .get());
-    }
-
-    private interface Template {
-        PipelineTemplateDescription makeTemplate() throws URISyntaxException;
-    }
-
-
-}
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/OntologyPipelineElement.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/OntologyPipelineElement.java
deleted file mode 100644
index b30062b..0000000
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/OntologyPipelineElement.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.streampipes.rest.impl;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonPrimitive;
-import org.apache.streampipes.model.SpDataStream;
-import org.apache.streampipes.model.graph.DataProcessorDescription;
-import org.apache.streampipes.model.graph.DataSinkDescription;
-import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
-import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
-import org.apache.streampipes.storage.management.StorageManager;
-
-import javax.ws.rs.*;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.util.ArrayList;
-import java.util.List;
-
-@Path("/v2/ontology")
-public class OntologyPipelineElement extends AbstractRestResource {
-
-  @Path("/sources")
-  @GET
-  @GsonWithIds
-  @Produces(MediaType.APPLICATION_JSON)
-  public Response getStreams() {
-    List<SpDataStream> result = new ArrayList<>();
-    List<SpDataStream> sesameSeps = StorageManager.INSTANCE.getPipelineElementStorage().getAllDataStreams();
-
-    for (SpDataStream sep : sesameSeps) {
-      result.add(new SpDataStream(sep));
-    }
-    return ok(result);
-  }
-
-  @Path("/sources/{sourceId}")
-  @GET
-  @GsonWithIds
-  @Produces(MediaType.APPLICATION_JSON)
-  public Response getSourceDetails(@PathParam("sourceId") String sepaId, @QueryParam("keepIds") boolean keepIds) {
-
-    SpDataStream sepaDescription = new SpDataStream(StorageManager.INSTANCE.getPipelineElementStorage().getDataStreamById(sepaId));
-    return ok(sepaDescription);
-  }
-
-  @Path("/sepas")
-  @GsonWithIds
-  @GET
-  @Produces(MediaType.APPLICATION_JSON)
-  public Response getSepas() {
-    JsonArray result = new JsonArray();
-    List<DataProcessorDescription> sesameSepas = StorageManager.INSTANCE.getPipelineElementStorage().getAllDataProcessors();
-
-    for (DataProcessorDescription sepa : sesameSepas) {
-      result.add(getHeader(sepa.getUri(), sepa.getName()));
-    }
-    return ok(result);
-
-  }
-
-  @Path("/actions")
-  @GET
-  @GsonWithIds
-  @Produces(MediaType.APPLICATION_JSON)
-  public Response getActions() {
-    List<DataSinkDescription> result = new ArrayList<>();
-    List<DataSinkDescription> sesameSecs = StorageManager.INSTANCE.getPipelineElementStorage().getAllDataSinks();
-
-    for (DataSinkDescription sec : sesameSecs) {
-      result.add(new DataSinkDescription(sec));
-    }
-    return ok(result);
-  }
-
-  public Response getStream(String streamId, @QueryParam("keepIds") boolean keepIds) {
-    // TODO Auto-generated method stub
-    return null;
-  }
-
-  @Path("/sepas/{sepaId}")
-  @GET
-  @Produces(MediaType.APPLICATION_JSON)
-  public Response getSepa(@PathParam("sepaId") String sepaId, @QueryParam("keepIds") boolean keepIds) {
-
-    DataProcessorDescription dataProcessorDescription = new DataProcessorDescription(StorageManager.INSTANCE.getPipelineElementStorage().getDataProcessorById(sepaId));
-    return ok(dataProcessorDescription);
-  }
-
-  @Path("/actions/{actionId}")
-  @GET
-  @Produces(MediaType.APPLICATION_JSON)
-  public Response getAction(@PathParam("actionId") String actionId, @QueryParam("keepIds") boolean keepIds) {
-    DataSinkDescription dataSinkDescription = new DataSinkDescription(StorageManager.INSTANCE.getPipelineElementStorage().getDataSinkById(actionId));
-    return ok(dataSinkDescription);
-  }
-
-  private JsonObject getHeader(String uri, String name) {
-    JsonObject jsonObj = new JsonObject();
-    jsonObj.add("uri", new JsonPrimitive(uri));
-    jsonObj.add("name", new JsonPrimitive(name));
-
-    return jsonObj;
-  }
-}
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java
index 55345c1..2f252b2 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java
@@ -38,12 +38,13 @@ import org.apache.streampipes.model.message.SuccessMessage;
 import org.apache.streampipes.model.pipeline.Pipeline;
 import org.apache.streampipes.model.pipeline.PipelineOperationStatus;
 import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource;
-import org.apache.streampipes.rest.impl.security.AuthConstants;
+import org.apache.streampipes.rest.security.AuthConstants;
 import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.security.access.prepost.PostFilter;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.security.access.prepost.PreFilter;
 import org.springframework.stereotype.Component;
 
 import javax.ws.rs.*;
@@ -126,7 +127,7 @@ public class PipelineResource extends AbstractAuthGuardedRestResource {
   @JacksonSerialized
   @Operation(summary = "Start the pipeline with the given id",
           tags = {"Pipeline"})
-  @PreAuthorize(AuthConstants.HAS_UPDATE_PIPELINE_PRIVILEGE)
+  @PreAuthorize(AuthConstants.HAS_WRITE_PIPELINE_PRIVILEGE)
   public Response start(@PathParam("pipelineId") String pipelineId) {
     try {
       PipelineOperationStatus status = PipelineManager.startPipeline(pipelineId);
@@ -144,7 +145,8 @@ public class PipelineResource extends AbstractAuthGuardedRestResource {
   @JacksonSerialized
   @Operation(summary = "Stop the pipeline with the given id",
           tags = {"Pipeline"})
-  @PreAuthorize(AuthConstants.HAS_UPDATE_PIPELINE_PRIVILEGE)
+  @PreAuthorize(AuthConstants.HAS_WRITE_PIPELINE_PRIVILEGE)
+  @PreFilter("hasPermission(pipelineId, 'WRITE')")
   public Response stop(@PathParam("pipelineId") String pipelineId,
                        @QueryParam("forceStop") @DefaultValue("false") boolean forceStop) {
     try {
@@ -162,7 +164,7 @@ public class PipelineResource extends AbstractAuthGuardedRestResource {
   @JacksonSerialized
   @Operation(summary = "Store a new pipeline",
           tags = {"Pipeline"})
-  @PreAuthorize(AuthConstants.HAS_CREATE_PIPELINE_PRIVILEGE)
+  @PreAuthorize(AuthConstants.HAS_WRITE_PIPELINE_PRIVILEGE)
   public Response addPipeline(Pipeline pipeline) {
 
     String pipelineId = PipelineManager.addPipeline(getAuthenticatedUserSid(), pipeline);
@@ -176,7 +178,7 @@ public class PipelineResource extends AbstractAuthGuardedRestResource {
   @Produces(MediaType.APPLICATION_JSON)
   @JacksonSerialized
   @Hidden
-  @PreAuthorize(AuthConstants.HAS_CREATE_PIPELINE_PRIVILEGE)
+  @PreAuthorize(AuthConstants.HAS_WRITE_PIPELINE_PRIVILEGE)
   public Response recommend(Pipeline pipeline) {
     try {
       return ok(Operations.findRecommendedElements(getAuthenticatedUsername(), pipeline));
@@ -199,7 +201,7 @@ public class PipelineResource extends AbstractAuthGuardedRestResource {
   @Consumes(MediaType.APPLICATION_JSON)
   @JacksonSerialized
   @Hidden
-  @PreAuthorize(AuthConstants.HAS_CREATE_PIPELINE_PRIVILEGE)
+  @PreAuthorize(AuthConstants.HAS_WRITE_PIPELINE_PRIVILEGE)
   public Response updateDataSet(SpDataSet spDataSet) {
     return ok(Operations.updateDataSet(spDataSet));
   }
@@ -210,7 +212,7 @@ public class PipelineResource extends AbstractAuthGuardedRestResource {
   @Consumes(MediaType.APPLICATION_JSON)
   @JacksonSerialized
   @Hidden
-  @PreAuthorize(AuthConstants.HAS_CREATE_PIPELINE_PRIVILEGE)
+  @PreAuthorize(AuthConstants.HAS_WRITE_PIPELINE_PRIVILEGE)
   public Response update(Pipeline pipeline) {
     try {
       return ok(Operations.validatePipeline(pipeline, true));
@@ -244,7 +246,7 @@ public class PipelineResource extends AbstractAuthGuardedRestResource {
   @JacksonSerialized
   @Operation(summary = "Update an existing pipeline",
           tags = {"Pipeline"})
-  @PreAuthorize(AuthConstants.HAS_UPDATE_PIPELINE_PRIVILEGE)
+  @PreAuthorize(AuthConstants.HAS_WRITE_PIPELINE_PRIVILEGE)
   public Response overwritePipeline(@PathParam("pipelineId") String pipelineId,
                                     Pipeline pipeline) {
     Pipeline storedPipeline = getPipelineStorage().getPipeline(pipelineId);
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventConsumer.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventConsumer.java
index 71f8633..60b15a7 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventConsumer.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventConsumer.java
@@ -21,7 +21,6 @@ package org.apache.streampipes.rest.impl;
 import org.apache.streampipes.model.graph.DataSinkDescription;
 import org.apache.streampipes.model.graph.DataSinkInvocation;
 import org.apache.streampipes.model.message.NotificationType;
-import org.apache.streampipes.model.message.Notifications;
 import org.apache.streampipes.rest.api.IPipelineElement;
 import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource;
 import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
@@ -51,17 +50,6 @@ public class SemanticEventConsumer extends AbstractAuthGuardedRestResource imple
   }
 
   @GET
-  @Path("/favorites")
-  @Produces(MediaType.APPLICATION_JSON)
-  @GsonWithIds
-  @Override
-  public Response getFavorites() {
-    List<DataSinkDescription> secs = Filter.byUri(getPipelineElementRdfStorage().getAllDataSinks(),
-            getUserService().getFavoriteActionUris(getAuthenticatedUsername()));
-    return ok(secs);
-  }
-
-  @GET
   @Path("/own")
   @Produces({MediaType.APPLICATION_JSON, SpMediaType.JSONLD})
   @JacksonSerialized
@@ -73,26 +61,6 @@ public class SemanticEventConsumer extends AbstractAuthGuardedRestResource imple
     return ok(si);
   }
 
-  @POST
-  @Path("/favorites")
-  @Produces(MediaType.APPLICATION_JSON)
-  @GsonWithIds
-  @Override
-  public Response addFavorite(@FormParam("uri") String elementUri) {
-    getUserService().addActionAsFavorite(getAuthenticatedUsername(), decode(elementUri));
-    return statusMessage(Notifications.success(NotificationType.OPERATION_SUCCESS));
-  }
-
-  @DELETE
-  @Path("/favorites/{elementId}")
-  @Produces(MediaType.APPLICATION_JSON)
-  @GsonWithIds
-  @Override
-  public Response removeFavorite(@PathParam("elementId") String elementId) {
-    getUserService().removeActionFromFavorites(getAuthenticatedUsername(), decode(elementId));
-    return statusMessage(Notifications.success(NotificationType.OPERATION_SUCCESS));
-  }
-
   @DELETE
   @Path("/own/{elementId}")
   @Produces(MediaType.APPLICATION_JSON)
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventProcessingAgent.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventProcessingAgent.java
index 3fdd8d4..8248ee9 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventProcessingAgent.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventProcessingAgent.java
@@ -21,7 +21,6 @@ package org.apache.streampipes.rest.impl;
 import org.apache.streampipes.model.graph.DataProcessorDescription;
 import org.apache.streampipes.model.graph.DataProcessorInvocation;
 import org.apache.streampipes.model.message.NotificationType;
-import org.apache.streampipes.model.message.Notifications;
 import org.apache.streampipes.rest.api.IPipelineElement;
 import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource;
 import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
@@ -48,17 +47,6 @@ public class SemanticEventProcessingAgent extends AbstractAuthGuardedRestResourc
 				getUserService().getAvailableSepaUris(getAuthenticatedUsername()));
 		return ok(sepas);
 	}
-	
-	@GET
-	@Path("/favorites")
-	@Produces(MediaType.APPLICATION_JSON)
-	@GsonWithIds
-	@Override
-	public Response getFavorites() {
-		List<DataProcessorDescription> sepas = Filter.byUri(getPipelineElementRdfStorage().getAllDataProcessors(),
-				getUserService().getFavoriteSepaUris(getAuthenticatedUsername()));
-		return ok(sepas);
-	}
 
 	@GET
 	@Path("/own")
@@ -75,26 +63,6 @@ public class SemanticEventProcessingAgent extends AbstractAuthGuardedRestResourc
 
 		return ok(si);
 	}
-
-	@POST
-	@Path("/favorites")
-	@Produces(MediaType.APPLICATION_JSON)
-	@GsonWithIds
-	@Override
-	public Response addFavorite(@FormParam("uri") String elementUri) {
-		getUserService().addSepaAsFavorite(getAuthenticatedUsername(), decode(elementUri));
-		return statusMessage(Notifications.success(NotificationType.OPERATION_SUCCESS));
-	}
-
-	@DELETE
-	@Path("/favorites/{elementUri}")
-	@Produces(MediaType.APPLICATION_JSON)
-	@GsonWithIds
-	@Override
-	public Response removeFavorite(@PathParam("elementUri") String elementUri) {
-		getUserService().removeSepaFromFavorites(getAuthenticatedUsername(), decode(elementUri));
-		return statusMessage(Notifications.success(NotificationType.OPERATION_SUCCESS));
-	}
 	
 	@DELETE
 	@Path("/own/{elementId}")
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventProducer.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventProducer.java
index bf5c921..4a4d3c2 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventProducer.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/SemanticEventProducer.java
@@ -20,7 +20,6 @@ package org.apache.streampipes.rest.impl;
 
 import org.apache.streampipes.model.SpDataStream;
 import org.apache.streampipes.model.message.NotificationType;
-import org.apache.streampipes.model.message.Notifications;
 import org.apache.streampipes.model.util.Cloner;
 import org.apache.streampipes.rest.api.IPipelineElement;
 import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource;
@@ -50,17 +49,6 @@ public class SemanticEventProducer extends AbstractAuthGuardedRestResource imple
 				getUserService().getAvailableSourceUris(getAuthenticatedUsername()));
 		return ok(seps);
 	}
-	
-	@GET
-	@Path("/favorites")
-	@Produces(MediaType.APPLICATION_JSON)
-	@GsonWithIds
-	@Override
-	public Response getFavorites() {
-		List<SpDataStream> seps = Filter.byUri(getPipelineElementRdfStorage().getAllDataStreams(),
-				getUserService().getFavoriteSourceUris(getAuthenticatedUsername()));
-		return ok(seps);
-	}
 
 	@GET
 	@Path("/own")
@@ -75,26 +63,6 @@ public class SemanticEventProducer extends AbstractAuthGuardedRestResource imple
 		return ok(si);
 	}
 
-	@POST
-	@Path("/favorites")
-	@Produces(MediaType.APPLICATION_JSON)
-	@GsonWithIds
-	@Override
-	public Response addFavorite(@FormParam("uri") String elementUri) {
-		getUserService().addSourceAsFavorite(getAuthenticatedUsername(), decode(elementUri));
-		return statusMessage(Notifications.success(NotificationType.OPERATION_SUCCESS));
-	}
-
-	@DELETE
-	@Path("/favorites/{elementUri}")
-	@Produces(MediaType.APPLICATION_JSON)
-	@GsonWithIds
-	@Override
-	public Response removeFavorite(@PathParam("elementUri") String elementUri) {
-		getUserService().removeSourceFromFavorites(getAuthenticatedUsername(), decode(elementUri));
-		return statusMessage(Notifications.success(NotificationType.OPERATION_SUCCESS));
-	}
-	
 	@DELETE
 	@Path("/own/{elementId}")
 	@Produces(MediaType.APPLICATION_JSON)
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Setup.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Setup.java
index 5b89102..9badbcf 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Setup.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Setup.java
@@ -20,13 +20,9 @@ package org.apache.streampipes.rest.impl;
 
 import com.google.gson.JsonObject;
 import org.apache.streampipes.config.backend.BackendConfig;
-import org.apache.streampipes.model.client.setup.InitialSettings;
-import org.apache.streampipes.model.message.Notifications;
 import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
-import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
 
 import javax.ws.rs.GET;
-import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
@@ -49,24 +45,4 @@ public class Setup extends AbstractRestResource {
       return ok(obj.toString());
     }
   }
-
-  @PUT
-  @Path("/configuration")
-  @GsonWithIds
-  @Produces(MediaType.APPLICATION_JSON)
-  public Response updateConfiguration(InitialSettings settings) {
-    try {
-      // TODO implement update consul configs
-//			ConfigurationManager
-//                    .storeWebappConfigurationToProperties(
-//                            new File(ConfigurationManager.getStreamPipesConfigFullPath()),
-//                           new File(ConfigurationManager.getStreamPipesConfigFileLocation()),
-//                            settings);
-      return ok(Notifications.success("Configuration updated"));
-    } catch (Exception e) {
-      e.printStackTrace();
-      return ok(Notifications.error("Error"));
-    }
-  }
-
 }
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ConsulConfig.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/ConsulConfig.java
similarity index 91%
rename from streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ConsulConfig.java
rename to streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/ConsulConfig.java
index fe4167d..2760ed2 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ConsulConfig.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/ConsulConfig.java
@@ -16,20 +16,22 @@
  *
  */
 
-package org.apache.streampipes.rest.impl;
+package org.apache.streampipes.rest.impl.admin;
 
 import com.google.gson.Gson;
 import com.google.gson.JsonObject;
 import org.apache.streampipes.config.backend.BackendConfig;
 import org.apache.streampipes.config.backend.MessagingSettings;
 import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
-import org.apache.streampipes.svcdiscovery.consul.ConsulSpConfig;
+import org.apache.streampipes.rest.security.AuthConstants;
+import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
+import org.apache.streampipes.svcdiscovery.api.ISpKvManagement;
 import org.apache.streampipes.svcdiscovery.api.model.ConfigItem;
 import org.apache.streampipes.svcdiscovery.api.model.PeConfig;
-import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
-import org.apache.streampipes.svcdiscovery.api.ISpKvManagement;
+import org.apache.streampipes.svcdiscovery.consul.ConsulSpConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.security.access.prepost.PreAuthorize;
 
 import javax.ws.rs.*;
 import javax.ws.rs.core.MediaType;
@@ -46,7 +48,8 @@ public class ConsulConfig extends AbstractRestResource {
 
   @GET
   @Produces(MediaType.APPLICATION_JSON)
-  @GsonWithIds
+  @JacksonSerialized
+  @PreAuthorize(AuthConstants.IS_ADMIN_ROLE)
   public Response getAllServiceConfigs() {
     LOG.info("Request for all service configs");
     Map<String, String> peServices = getServiceDiscovery().getExtensionsServiceGroups();
@@ -78,13 +81,13 @@ public class ConsulConfig extends AbstractRestResource {
       peConfigs.add(peConfig);
     }
 
-    String json = new Gson().toJson(peConfigs);
-    return Response.ok(json).build();
+    return ok(peConfigs);
   }
 
   @POST
   @Produces(MediaType.APPLICATION_JSON)
-  @GsonWithIds
+  @JacksonSerialized
+  @PreAuthorize(AuthConstants.IS_ADMIN_ROLE)
   public Response saveServiceConfig(PeConfig peConfig) {
 
     ISpKvManagement keyValueStore = getKeyValueStore();
@@ -139,7 +142,8 @@ public class ConsulConfig extends AbstractRestResource {
 
   @DELETE
   @Produces(MediaType.APPLICATION_JSON)
-  @GsonWithIds
+  @JacksonSerialized
+  @PreAuthorize(AuthConstants.IS_ADMIN_ROLE)
   public Response deleteService(String serviceName) {
     LOG.info("Request to delete a service config");
     getServiceDiscovery().deregisterService(serviceName);
@@ -148,8 +152,9 @@ public class ConsulConfig extends AbstractRestResource {
 
   @GET
   @Produces(MediaType.APPLICATION_JSON)
-  @GsonWithIds
+  @JacksonSerialized
   @Path("/messaging")
+  @PreAuthorize(AuthConstants.IS_ADMIN_ROLE)
   public Response getMessagingSettings() {
     return ok(BackendConfig.INSTANCE.getMessagingSettings());
   }
@@ -157,8 +162,9 @@ public class ConsulConfig extends AbstractRestResource {
   @POST
   @Produces(MediaType.APPLICATION_JSON)
   @Consumes(MediaType.APPLICATION_JSON)
-  @GsonWithIds
+  @JacksonSerialized
   @Path("messaging")
+  @PreAuthorize(AuthConstants.IS_ADMIN_ROLE)
   public Response updateMessagingSettings(MessagingSettings messagingSettings) {
     BackendConfig.INSTANCE.setMessagingSettings(messagingSettings);
     return ok();
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/EmailConfigurationResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/EmailConfigurationResource.java
index 388d842..2a5eea0 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/EmailConfigurationResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/EmailConfigurationResource.java
@@ -21,8 +21,10 @@ import org.apache.streampipes.config.backend.BackendConfig;
 import org.apache.streampipes.config.backend.model.EmailConfig;
 import org.apache.streampipes.mail.MailTester;
 import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource;
+import org.apache.streampipes.rest.security.AuthConstants;
 import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
 import org.simplejavamail.MailException;
+import org.springframework.security.access.prepost.PreAuthorize;
 
 import javax.ws.rs.*;
 import javax.ws.rs.core.MediaType;
@@ -34,6 +36,7 @@ public class EmailConfigurationResource extends AbstractAuthGuardedRestResource
   @GET
   @JacksonSerialized
   @Produces(MediaType.APPLICATION_JSON)
+  @PreAuthorize(AuthConstants.IS_ADMIN_ROLE)
   public Response getMailConfiguration() {
     return ok(BackendConfig.INSTANCE.getEmailConfig());
   }
@@ -41,6 +44,7 @@ public class EmailConfigurationResource extends AbstractAuthGuardedRestResource
   @PUT
   @JacksonSerialized
   @Consumes(MediaType.APPLICATION_JSON)
+  @PreAuthorize(AuthConstants.IS_ADMIN_ROLE)
   public Response updateMailConfiguration(EmailConfig config) {
     config.setEmailConfigured(true);
     BackendConfig.INSTANCE.updateEmailConfig(config);
@@ -51,6 +55,7 @@ public class EmailConfigurationResource extends AbstractAuthGuardedRestResource
   @POST
   @Path("/test")
   @Consumes(MediaType.APPLICATION_JSON)
+  @PreAuthorize(AuthConstants.IS_ADMIN_ROLE)
   public Response sendTestMail(EmailConfig config) {
     try {
       new MailTester().sendTestMail(config);
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/UserGroupResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/UserGroupResource.java
similarity index 87%
rename from streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/UserGroupResource.java
rename to streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/UserGroupResource.java
index a5d786b..8e34d9a 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/UserGroupResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/UserGroupResource.java
@@ -15,11 +15,13 @@
  * limitations under the License.
  *
  */
-package org.apache.streampipes.rest.impl;
+package org.apache.streampipes.rest.impl.admin;
 
 import org.apache.streampipes.model.client.user.Group;
 import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource;
+import org.apache.streampipes.rest.security.AuthConstants;
 import org.apache.streampipes.storage.api.IUserGroupStorage;
+import org.springframework.security.access.prepost.PreAuthorize;
 
 import javax.ws.rs.*;
 import javax.ws.rs.core.Response;
@@ -28,11 +30,13 @@ import javax.ws.rs.core.Response;
 public class UserGroupResource extends AbstractAuthGuardedRestResource {
 
   @GET
+  @PreAuthorize(AuthConstants.IS_ADMIN_ROLE)
   public Response getAllUserGroups() {
     return ok(getUserGroupStorage().getAll());
   }
 
   @POST
+  @PreAuthorize(AuthConstants.IS_ADMIN_ROLE)
   public Response addUserGroup(Group group) {
     getUserGroupStorage().createElement(group);
     return ok();
@@ -40,6 +44,7 @@ public class UserGroupResource extends AbstractAuthGuardedRestResource {
 
   @PUT
   @Path("{groupId}")
+  @PreAuthorize(AuthConstants.IS_ADMIN_ROLE)
   public Response updateUserGroup(@PathParam("groupId") String groupId,
                                   Group group) {
     if (!groupId.equals(group.getGroupId())) {
@@ -51,6 +56,7 @@ public class UserGroupResource extends AbstractAuthGuardedRestResource {
 
   @DELETE
   @Path("{groupId}")
+  @PreAuthorize(AuthConstants.IS_ADMIN_ROLE)
   public Response deleteUserGroup(@PathParam("groupId") String groupId) {
     Group group = getUserGroupStorage().getElementById(groupId);
     if (group != null) {
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/nouser/PipelineNoUserResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/nouser/PipelineNoUserResource.java
deleted file mode 100644
index b1228dc..0000000
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/nouser/PipelineNoUserResource.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.streampipes.rest.impl.nouser;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
-import org.apache.streampipes.rest.management.PipelineManagement;
-import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
-import org.apache.streampipes.rest.shared.annotation.NoAuthenticationRequired;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-@Path("/v2/pipelines")
-public class PipelineNoUserResource extends AbstractRestResource {
-
-    private static final Logger logger = LoggerFactory.getLogger(PipelineNoUserResource.class);
-
-    @Path("/{pipelineId}/stopAdapter")
-    @GET
-    @Produces(MediaType.APPLICATION_JSON)
-    @GsonWithIds
-    @NoAuthenticationRequired
-    public Response stop(@PathParam("pipelineId") String pipelineId) {
-        logger.info("Pipeline: " + pipelineId + " was stopped by the system");
-        PipelineManagement pm = new PipelineManagement();
-        return pm.stopPipeline(pipelineId, false);
-    }
-}
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/management/PipelineManagement.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/management/PipelineManagement.java
deleted file mode 100644
index f3619f5..0000000
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/management/PipelineManagement.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.streampipes.rest.management;
-
-import org.apache.streampipes.manager.operations.Operations;
-import org.apache.streampipes.model.message.Notification;
-import org.apache.streampipes.model.message.NotificationType;
-import org.apache.streampipes.model.pipeline.Pipeline;
-import org.apache.streampipes.model.pipeline.PipelineOperationStatus;
-import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
-
-import javax.ws.rs.core.Response;
-
-@Deprecated
-public class PipelineManagement extends AbstractRestResource {
-
-    public Response stopPipeline(String pipelineId,
-                                 boolean forceStop) {
-        try {
-            Pipeline pipeline = getPipelineStorage().getPipeline(pipelineId);
-            PipelineOperationStatus status = Operations.stopPipeline(pipeline, forceStop);
-            return ok(status);
-        } catch
-                (Exception e) {
-            e.printStackTrace();
-            return constructErrorMessage(new Notification(NotificationType.UNKNOWN_ERROR.title(), NotificationType.UNKNOWN_ERROR.description(), e.getMessage()));
-        }
-    }
-
-}
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/security/AuthConstants.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/security/AuthConstants.java
similarity index 86%
rename from streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/security/AuthConstants.java
rename to streampipes-rest/src/main/java/org/apache/streampipes/rest/security/AuthConstants.java
index f457f47..99a62b1 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/security/AuthConstants.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/security/AuthConstants.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  *
  */
-package org.apache.streampipes.rest.impl.security;
+package org.apache.streampipes.rest.security;
 
 import static org.apache.streampipes.model.client.user.Privilege.Constants.*;
 import static org.apache.streampipes.model.client.user.Role.Constants.*;
@@ -39,8 +39,7 @@ public class AuthConstants {
   public static final String IS_DASHBOARD_USER_ROLE = HAS_ANY_ROLE + ROLE_DASHBOARD_USER_VALUE + Q + BE;
 
   public static final String HAS_READ_PIPELINE_PRIVILEGE = BS + IS_ADMIN_ROLE + OR + HAS_ANY_AUTHORITY + PRIVILEGE_READ_PIPELINE_VALUE + Q + BE2;
-  public static final String HAS_CREATE_PIPELINE_PRIVILEGE = BS + IS_ADMIN_ROLE + OR + HAS_ANY_AUTHORITY + PRIVILEGE_CREATE_PIPELINE_VALUE + Q + BE2;
-  public static final String HAS_UPDATE_PIPELINE_PRIVILEGE = BS + IS_ADMIN_ROLE + OR + HAS_ANY_AUTHORITY + PRIVILEGE_UPDATE_PIPELINE_VALUE + Q + BE2;
+  public static final String HAS_WRITE_PIPELINE_PRIVILEGE = BS + IS_ADMIN_ROLE + OR + HAS_ANY_AUTHORITY + PRIVILEGE_WRITE_PIPELINE_VALUE + Q + BE2;
   public static final String HAS_DELETE_PIPELINE_PRIVILEGE = BS + IS_ADMIN_ROLE + OR + HAS_ANY_AUTHORITY + PRIVILEGE_DELETE_PIPELINE_VALUE + Q + BE2;
 
   public static final String IS_AUTHENTICATED = "isAuthenticated()";
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/security/SpPermissionEvaluator.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/security/SpPermissionEvaluator.java
similarity index 97%
rename from streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/security/SpPermissionEvaluator.java
rename to streampipes-rest/src/main/java/org/apache/streampipes/rest/security/SpPermissionEvaluator.java
index d33c153..38fd664 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/security/SpPermissionEvaluator.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/security/SpPermissionEvaluator.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  *
  */
-package org.apache.streampipes.rest.impl.security;
+package org.apache.streampipes.rest.security;
 
 import org.apache.streampipes.user.management.model.PrincipalUserDetails;
 import org.springframework.context.annotation.Configuration;