api/src/main/java/com/epam/pipeline/manager/security/run/RunPermissionManager.java
public boolean commitPermission(Long registryId, String image, String permission) {
        DockerRegistry registry = registryManager.load(registryId);
        try {
            String trimmedImage = image.startsWith(registry.getPath()) ?
                    image.substring(registry.getPath().length() + 1) : image;
            ToolGroup toolGroup = toolGroupManager.loadToolGroupByImage(registry.getPath(), trimmedImage);
            Optional<Tool> tool = toolManager.loadToolInGroup(trimmedImage, toolGroup.getId());
            return tool.map(t -> t.isNotSymlink() && permissionsHelper.isAllowed(permission, t))
                    .orElseGet(() -> permissionsHelper.isAllowed(permission, toolGroup));
        } catch (IllegalArgumentException e) {
            //case when tool group doesn't exist
            log.trace(e.getMessage(), e);
            return permissionsHelper.isAllowed(permission, registry);
        }
    }
/**
     * Method will check permission for a {@link Tool} if it is registered, or for {@link ToolGroup}
     * if this is a new {@link Tool}. If both {@link Tool} and {@link ToolGroup} do not exist,
     * permission for {@link DockerRegistry} will be checked. Image is expected in format 'group/image'.
     * @param registryId
     * @param image
     * @param permission
     * @return
     */
Method will check permission for a  Tool if it is registered, or for  ToolGroup
if this is a new  Tool. If both  Tool and  ToolGroup do not exist,
permission for  DockerRegistry will be checked. Image is expected in format 'group/image'.
Method will check permission for a Tool if it is registered or for ToolGroup if this is a new Tool . If both Tool and ToolGroup do not exist permission for DockerRegistry will be checked . Image is expected in format ' group / image ' .
public boolean commitPermission(Long registryId, String image, String permission) {
        DockerRegistry registry = registryManager.load(registryId);
        try {
            String trimmedImage = image.startsWith(registry.getPath()) ?
                    image.substring(registry.getPath().length() + 1) : image;
            ToolGroup toolGroup = toolGroupManager.loadToolGroupByImage(registry.getPath(), trimmedImage);
            Optional<Tool> tool = toolManager.loadToolInGroup(trimmedImage, toolGroup.getId());
            return tool.map(t -> t.isNotSymlink() && permissionsHelper.isAllowed(permission, t))
                    .orElseGet(() -> permissionsHelper.isAllowed(permission, toolGroup));
        } catch (IllegalArgumentException e) {
            log.trace(e.getMessage(), e);
            return permissionsHelper.isAllowed(permission, registry);
        }
    }
public boolean commitPermission ( Long registryId , String image , String permission ) { DockerRegistry registry = registryManager . load ( registryId ) ; try { String trimmedImage = image . startsWith ( registry . getPath ( ) ) ? image . substring ( registry . getPath ( ) . length ( ) + 1 ) : image ; ToolGroup toolGroup = toolGroupManager . loadToolGroupByImage ( registry . getPath ( ) , trimmedImage ) ; Optional < Tool > tool = toolManager . loadToolInGroup ( trimmedImage , toolGroup . getId ( ) ) ; return tool . map ( t -> t . isNotSymlink ( ) && permissionsHelper . isAllowed ( permission , t ) ) . orElseGet ( ( ) -> permissionsHelper . isAllowed ( permission , toolGroup ) ) ; } catch ( IllegalArgumentException e ) { log . trace ( e . getMessage ( ) , e ) ; return permissionsHelper . isAllowed ( permission , registry ) ; } }
Method will check permission for a {@link Tool} if it is registered, or for {@link ToolGroup}
 if this is a new {@link Tool}.
Method will check permission for a { @link Tool } if it is registered or for { @link ToolGroup } if this is a new { @link Tool } .
//case when tool group doesn't exist