Search in sources :

Example 1 with FilingParameters

use of org.alfresco.repo.virtual.template.FilingParameters in project alfresco-repository by Alfresco.

the class GetAllSetPermissionsMethod method execute.

@Override
public Set<AccessPermission> execute(VirtualProtocol virtualProtocol, Reference reference) throws ProtocolMethodException {
    Set<String> toAllow = userPermissions.getAllowSmartNodes();
    Set<String> toDeny = userPermissions.getDenySmartNodes();
    VirtualFolderDefinition definition = resolver.resolveVirtualFolderDefinition(reference);
    FilingRule filingRule = definition.getFilingRule();
    boolean readonly = filingRule.isNullFilingRule() || filingRule.filingNodeRefFor(new FilingParameters(reference)) == null;
    if (readonly) {
        Set<String> deniedPermissions = userPermissions.getDenyReadonlySmartNodes();
        toDeny = new HashSet<>(toDeny);
        toDeny.addAll(deniedPermissions);
        toAllow.add(PermissionService.READ);
    }
    return execute(reference, toAllow, toDeny);
}
Also used : FilingParameters(org.alfresco.repo.virtual.template.FilingParameters) VirtualFolderDefinition(org.alfresco.repo.virtual.template.VirtualFolderDefinition) FilingRule(org.alfresco.repo.virtual.template.FilingRule)

Example 2 with FilingParameters

use of org.alfresco.repo.virtual.template.FilingParameters in project alfresco-repository by Alfresco.

the class VirtualStoreImpl method createFilingData.

@Override
public FilingData createFilingData(Reference parentReference, QName assocTypeQName, QName assocQName, QName nodeTypeQName, Map<QName, Serializable> properties) throws VirtualizationException {
    VirtualFolderDefinition structure = resolveVirtualFolderDefinition(parentReference);
    FilingRule filingRule = structure.getFilingRule();
    if (filingRule == null) {
        filingRule = new NullFilingRule(environment);
    }
    FilingParameters filingParameters = new FilingParameters(parentReference, assocTypeQName, assocQName, nodeTypeQName, properties);
    FilingData filingData = filingRule.createFilingData(filingParameters);
    return filingData;
}
Also used : NullFilingRule(org.alfresco.repo.virtual.template.NullFilingRule) FilingParameters(org.alfresco.repo.virtual.template.FilingParameters) FilingData(org.alfresco.repo.virtual.template.FilingData) VirtualFolderDefinition(org.alfresco.repo.virtual.template.VirtualFolderDefinition) FilingRule(org.alfresco.repo.virtual.template.FilingRule) NullFilingRule(org.alfresco.repo.virtual.template.NullFilingRule)

Example 3 with FilingParameters

use of org.alfresco.repo.virtual.template.FilingParameters in project alfresco-repository by Alfresco.

the class HasPermissionMethod method execute.

@Override
public AccessStatus execute(VirtualProtocol virtualProtocol, Reference reference) throws ProtocolMethodException {
    VirtualFolderDefinition definition = resolver.resolveVirtualFolderDefinition(reference);
    FilingRule filingRule = definition.getFilingRule();
    boolean readonly = filingRule.isNullFilingRule() || filingRule.filingNodeRefFor(new FilingParameters(reference)) == null;
    if (readonly) {
        Set<String> deniedPermissions = userPermissions.getDenyReadonlySmartNodes();
        if (deniedPermissions.contains(permissionToCheck)) {
            return AccessStatus.DENIED;
        }
        if (PermissionService.READ.equals(permissionToCheck)) {
            return AccessStatus.ALLOWED;
        }
    }
    return userPermissions.hasVirtualNodePermission(permissionToCheck, readonly);
}
Also used : FilingParameters(org.alfresco.repo.virtual.template.FilingParameters) VirtualFolderDefinition(org.alfresco.repo.virtual.template.VirtualFolderDefinition) FilingRule(org.alfresco.repo.virtual.template.FilingRule)

Example 4 with FilingParameters

use of org.alfresco.repo.virtual.template.FilingParameters in project alfresco-repository by Alfresco.

the class GetSetPermissionsMethod method execute.

@Override
public NodePermissionEntry execute(VirtualProtocol virtualProtocol, Reference reference) throws ProtocolMethodException {
    Set<String> toAllow = userPermissions.getAllowSmartNodes();
    Set<String> toDeny = userPermissions.getDenySmartNodes();
    VirtualFolderDefinition definition = resolver.resolveVirtualFolderDefinition(reference);
    FilingRule filingRule = definition.getFilingRule();
    boolean readonly = filingRule.isNullFilingRule() || filingRule.filingNodeRefFor(new FilingParameters(reference)) == null;
    if (readonly) {
        Set<String> deniedPermissions = userPermissions.getDenyReadonlySmartNodes();
        toDeny = new HashSet<>(toDeny);
        toDeny.addAll(deniedPermissions);
        toAllow.add(PermissionService.READ);
    }
    return execute(reference, toAllow, toDeny);
}
Also used : FilingParameters(org.alfresco.repo.virtual.template.FilingParameters) VirtualFolderDefinition(org.alfresco.repo.virtual.template.VirtualFolderDefinition) FilingRule(org.alfresco.repo.virtual.template.FilingRule)

Aggregations

FilingParameters (org.alfresco.repo.virtual.template.FilingParameters)4 FilingRule (org.alfresco.repo.virtual.template.FilingRule)4 VirtualFolderDefinition (org.alfresco.repo.virtual.template.VirtualFolderDefinition)4 FilingData (org.alfresco.repo.virtual.template.FilingData)1 NullFilingRule (org.alfresco.repo.virtual.template.NullFilingRule)1