diff options
author | ayalaben <ayala.benzvi@amdocs.com> | 2018-04-10 13:43:01 +0300 |
---|---|---|
committer | Oren Kleks <orenkle@amdocs.com> | 2018-04-12 07:15:06 +0000 |
commit | 8dfa832a4bbe276fdf898330325321a776ac253e (patch) | |
tree | 2ed00333197348dfb0b933f2c6935ca1c9db9122 /openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java | |
parent | fe35212bee3b89dcee98a11dd364218c587aa41a (diff) |
User Permission items
Change-Id: Ice1d126dd29e9f49ca90ada7b1671c72545c9ee8
Issue-ID: SDC-1202
Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java')
6 files changed, 91 insertions, 54 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/ItemPermissionsManager.java b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/ItemPermissionsManager.java deleted file mode 100644 index 1ca37325ca..0000000000 --- a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/ItemPermissionsManager.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.openecomp.sdc.itempermissions; - -import org.openecomp.sdc.itempermissions.type.ItemPermissionsEntity; - -import java.util.Collection; -import java.util.Set; - -/** - * Created by ayalaben on 6/18/2017. - */ -public interface ItemPermissionsManager { - - Collection<ItemPermissionsEntity> listItemPermissions(String itemId); - - void updateItemPermissions(String itemId, String permission, Set<String> addedUsersIds, - Set<String> removedUsersIds); - - boolean isAllowed(String itemId,String userId,String action); - - String getUserItemPermiission(String itemId, String userId); - - void deleteItemPermissions(String itemId); - - -} diff --git a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/ItemPermissionsManagerFactory.java b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/ItemPermissionsManagerFactory.java deleted file mode 100644 index b983314b31..0000000000 --- a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/ItemPermissionsManagerFactory.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.openecomp.sdc.itempermissions; - -import org.openecomp.core.factory.api.AbstractComponentFactory; -import org.openecomp.core.factory.api.AbstractFactory; - -/** - * Created by ayalaben on 6/18/2017. - */ -public abstract class ItemPermissionsManagerFactory extends - AbstractComponentFactory<ItemPermissionsManager> { - - public static ItemPermissionsManagerFactory getInstance() { - return AbstractFactory.getInstance(ItemPermissionsManagerFactory.class); - } -} diff --git a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/PermissionsManager.java b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/PermissionsManager.java new file mode 100644 index 0000000000..09f6048f82 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/PermissionsManager.java @@ -0,0 +1,42 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed 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.openecomp.sdc.itempermissions; + +import org.openecomp.sdc.itempermissions.type.ItemPermissionsEntity; + +import java.util.Collection; +import java.util.Set; + +/** + * Created by ayalaben on 6/18/2017. + */ +public interface PermissionsManager { + + Collection<ItemPermissionsEntity> listItemPermissions(String itemId); + + Set<String> listUserPermittedItems(String userId, String permission); + + void updateItemPermissions(String itemId, String permission, Set<String> addedUsersIds, + Set<String> removedUsersIds); + + boolean isAllowed(String itemId,String userId,String action); + + String getUserItemPermission(String itemId, String userId); + + void deleteItemPermissions(String itemId); + + +} diff --git a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/PermissionsManagerFactory.java b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/PermissionsManagerFactory.java new file mode 100644 index 0000000000..0353e5ce03 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/PermissionsManagerFactory.java @@ -0,0 +1,30 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * Licensed 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.openecomp.sdc.itempermissions; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +/** + * Created by ayalaben on 6/18/2017. + */ +public abstract class PermissionsManagerFactory extends + AbstractComponentFactory<PermissionsManager> { + + public static PermissionsManagerFactory getInstance() { + return AbstractFactory.getInstance(PermissionsManagerFactory.class); + } +} diff --git a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsManagerFactoryImpl.java index 6e41465a11..14539b0fa1 100644 --- a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerFactoryImpl.java +++ b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsManagerFactoryImpl.java @@ -16,8 +16,8 @@ package org.openecomp.sdc.itempermissions.dao.impl; -import org.openecomp.sdc.itempermissions.ItemPermissionsManager; -import org.openecomp.sdc.itempermissions.ItemPermissionsManagerFactory; +import org.openecomp.sdc.itempermissions.PermissionsManager; +import org.openecomp.sdc.itempermissions.PermissionsManagerFactory; import org.openecomp.sdc.itempermissions.PermissionsServicesFactory; import org.openecomp.sdc.notification.factories.NotificationPropagationManagerFactory; import org.openecomp.sdc.notification.factories.SubscriptionServiceFactory; @@ -26,16 +26,16 @@ import org.openecomp.sdc.versioning.AsdcItemManagerFactory; /** * Created by ayalaben on 6/18/2017 */ -public class ItemPermissionsManagerFactoryImpl extends ItemPermissionsManagerFactory { +public class PermissionsManagerFactoryImpl extends PermissionsManagerFactory { - private static final ItemPermissionsManager INSTANCE = - new ItemPermissionsManagerImpl(PermissionsServicesFactory.getInstance().createInterface(), + private static final PermissionsManager INSTANCE = + new PermissionsManagerImpl(PermissionsServicesFactory.getInstance().createInterface(), AsdcItemManagerFactory.getInstance().createInterface(), NotificationPropagationManagerFactory.getInstance().createInterface(), SubscriptionServiceFactory.getInstance().createInterface()); @Override - public ItemPermissionsManager createInterface() { + public PermissionsManager createInterface() { return INSTANCE; } } diff --git a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImpl.java b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsManagerImpl.java index a68c2d89f9..741053017c 100644 --- a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/ItemPermissionsManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/main/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsManagerImpl.java @@ -32,7 +32,7 @@ import org.openecomp.sdc.common.errors.ErrorCategory; import org.openecomp.sdc.common.errors.ErrorCode; import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.common.session.SessionContextProviderFactory; -import org.openecomp.sdc.itempermissions.ItemPermissionsManager; +import org.openecomp.sdc.itempermissions.PermissionsManager; import org.openecomp.sdc.itempermissions.PermissionsServices; import org.openecomp.sdc.itempermissions.impl.types.PermissionTypes; import org.openecomp.sdc.itempermissions.type.ItemPermissionsEntity; @@ -47,9 +47,9 @@ import org.openecomp.sdc.versioning.types.Item; /** * Created by ayalaben on 6/18/2017. */ -public class ItemPermissionsManagerImpl implements ItemPermissionsManager { +public class PermissionsManagerImpl implements PermissionsManager { - private static final Logger LOGGER = LoggerFactory.getLogger(ItemPermissionsManagerImpl.class); + private static final Logger LOGGER = LoggerFactory.getLogger(PermissionsManagerImpl.class); private static final String CHANGE_PERMISSIONS = "Change_Item_Permissions"; private PermissionsServices permissionsServices; @@ -57,10 +57,10 @@ public class ItemPermissionsManagerImpl implements ItemPermissionsManager { private NotificationPropagationManager notifier; private SubscriptionService subscriptionService; - public ItemPermissionsManagerImpl(PermissionsServices permissionsServices, - AsdcItemManager asdcItemManager, - NotificationPropagationManager notificationPropagationManager, - SubscriptionService subscriptionService) { + public PermissionsManagerImpl(PermissionsServices permissionsServices, + AsdcItemManager asdcItemManager, + NotificationPropagationManager notificationPropagationManager, + SubscriptionService subscriptionService) { this.permissionsServices = permissionsServices; this.asdcItemManager = asdcItemManager; this.notifier = notificationPropagationManager; @@ -74,6 +74,11 @@ public class ItemPermissionsManagerImpl implements ItemPermissionsManager { } @Override + public Set<String> listUserPermittedItems(String userId, String permission) { + return permissionsServices.listUserPermittedItems(userId,permission); + } + + @Override public void updateItemPermissions(String itemId, String permission, Set<String> addedUsersIds, Set<String> removedUsersIds) { @@ -145,7 +150,7 @@ public class ItemPermissionsManagerImpl implements ItemPermissionsManager { } @Override - public String getUserItemPermiission(String itemId, String userId) { + public String getUserItemPermission(String itemId, String userId) { return permissionsServices.getUserItemPermiission(itemId, userId); } |