/** * Deletes a PropertyTagEntity identified by its Id * @param propertyTagId * @return */ @HasPermission(permission = Permission.MANAGE_GLOBAL_TAGS) public boolean deletePropertyTag(Integer propertyTagId) { return propertyTagService.deletePropertyTagById(propertyTagId); }
/** * Returns a list of all Roles (used by REST) * * @return List<RoleEntity> */ @HasPermission(permission = Permission.ASSIGN_REMOVE_PERMISSION) public List<RoleEntity> getAllRoles() { return permissionRepository.getAllRoles(); }
/** * Returns a cached list of all Restrictions assigned to a specific UserRestriction (used by REST) * * @return List<RestrictionEntity> for the logged in user */ @HasPermission(oneOfPermission = { Permission.ASSIGN_REMOVE_PERMISSION, Permission.PERMISSION_DELEGATION }) public List<RestrictionEntity> getRestrictionsForLoggedInUser() { return permissionService.getUserRestrictionsForLoggedInUser(); }
/** * Returns a list of all Permissions of the calling user * * @return List<PermissionEntity> */ @HasPermission(permission = Permission.PERMISSION_DELEGATION) public List<RestrictionEntity> getAllCallerRestrictions() { return permissionService.getAllCallerRestrictions(); }
/** * Returns an uncached list of all available Restrictions assigned to UserRestriction (used by REST) * * @return List<RestrictionEntity> */ @HasPermission(permission = Permission.ASSIGN_REMOVE_PERMISSION) public List<RestrictionEntity> getAllUserRestriction() { return permissionService.getAllUserRestrictions(); }
/** * Returns an uncached list of all available UserRestriction names (used by REST) * * @return List<String> UserRestriction.name */ @HasPermission(oneOfPermission = { Permission.ASSIGN_REMOVE_PERMISSION, Permission.PERMISSION_DELEGATION }) public List<String> getAllUserRestrictionNames() { return permissionRepository.getAllUserRestrictionNames(); }
/** * Persists the given new release. */ @HasPermission(permission = Permission.RELEASE, action = CREATE) public boolean create(ReleaseEntity release) throws GeneralDBException { return persistenceService.saveReleaseEntity(release); }
/** * Returns a list of all PermissionEntities (used by REST) * * @return List<PermissionEntity> */ @HasPermission(permission = Permission.ASSIGN_REMOVE_PERMISSION) public List<PermissionEntity> getAllAvailablePermissions() { return permissionRepository.getAllPermissions(); }
/** * Returns a list of releases for management operations. This means, we * don't care about relations to resources or deployments but only want to * create, edit or delete plain release-instances */ @HasPermission(permission = Permission.RELEASE, action = READ) public List<ReleaseEntity> loadReleasesForMgmt(int startIndex, int length, boolean sortDesc) { return persistenceService.loadReleaseEntities(startIndex, length, sortDesc); }
/** * @return the number of existing releases */ @HasPermission(permission = Permission.RELEASE, action = READ) public int countReleases() { return persistenceService.count(); }
/** * Persists the given release - the already existing instance will be updated. */ @HasPermission(permission = Permission.RELEASE, action = UPDATE) public boolean update(ReleaseEntity release) throws GeneralDBException { return persistenceService.saveReleaseEntity(release); }
@HasPermission(permission = Permission.MANAGE_GLOBAL_FUNCTIONS) public void deleteGlobalFunction(GlobalFunctionEntity function) { functionService.deleteFunction(function); }
@HasPermission(permission = Permission.RELEASE, action = DELETE) public void delete(ReleaseEntity release) { releaseRepository.removeRelease(release); } }
/** * Adds a PropertyTagEntity of PropertyTagType.GLOBAL * @param propertyTagName */ @HasPermission(permission = Permission.MANAGE_GLOBAL_TAGS) public void addGlobalPropertyTag(String propertyTagName) { addPropertyTag(propertyTagName, PropertyTagType.GLOBAL); }
@HasPermission(permission = Permission.MANAGE_GLOBAL_FUNCTIONS) public void deleteGlobalFunction(Integer globalFunctionId) { GlobalFunctionEntity gf = entityManager.find(GlobalFunctionEntity.class, globalFunctionId); deleteGlobalFunction(gf); }
@HasPermission(permission = Permission.MANAGE_DEPLOYMENT_PARAMETER, action = DELETE) public void deleteDeployParameterKey(Key keyToDelete) { Key attachedKeyToDelete = keyRepository.find(Objects.requireNonNull(keyToDelete, "Must not be null").getId()); keyRepository.remove(attachedKeyToDelete); }
@HasPermission(permission = Permission.MANAGE_GLOBAL_FUNCTIONS) public boolean saveGlobalFunction(GlobalFunctionEntity function) throws AMWException { if (function != null) { if (StringUtils.isEmpty(function.getName())) { throw new AMWException("The function name must not be empty"); } freemarkerValidator.validateFreemarkerSyntax(function.getContent()); return functionService.saveFunction(function); } return true; } }
@HasPermission(permission = Permission.ASSIGN_REMOVE_PERMISSION, action = Action.DELETE) public void removeRestriction(Integer id, boolean reload) throws AMWException { if (restrictionRepository.find(id) == null) { throw new AMWException("Restriction not found"); } restrictionRepository.deleteRestrictionById(id); if (reload) { reloadCache(); } }
/** * Checks Permissions and Persists the given shakedown test property descriptor to the database for resource instance */ @HasPermission(permission = Permission.SHAKEDOWN_TEST_MODE) public PropertyDescriptorEntity saveTestingPropertyDescriptorForResource(Integer resourceId, PropertyDescriptorEntity descriptor,int foreignableHashBeforeModification, String propertyTagsString) throws AMWException, ForeignableOwnerViolationException { // verify if modifications are allowed foreignableService.verifyEditableByOwner(ForeignableOwner.getSystemOwner(), foreignableHashBeforeModification, descriptor); return savePropertyDescriptorResource(ForeignableOwner.getSystemOwner(), resourceId, descriptor, propertyTagsString); }
/** * Checks Permissions and Persists the given shakedown test property descriptor to the database for resource type */ @HasPermission(permission = Permission.SHAKEDOWN_TEST_MODE) public PropertyDescriptorEntity saveTestingPropertyDescriptorForResourceType(Integer resourceTypeId, PropertyDescriptorEntity descriptor, int foreignableHashBeforeModification, String propertyTagsString) throws AMWException, ForeignableOwnerViolationException { // verify if modifications are allowed foreignableService.verifyEditableByOwner(ForeignableOwner.getSystemOwner(), foreignableHashBeforeModification, descriptor); return savePropertyDescriptorResourceType(ForeignableOwner.getSystemOwner(), resourceTypeId, descriptor, propertyTagsString); }