Lime Web Components API Documentation - v7.4.0
    Preparing search index...

    Interface Acl

    Access Control List defining CRUD permissions for a limetype or property

    The Acl interface represents the user's permissions for a LimeType or LimeProperty. It follows the standard CRUD (Create, Read, Update, Delete) permission model.

    ACL permissions are typically checked before allowing users to perform operations on a type or property, and can be used to conditionally show or hide UI elements based on what the user is allowed to do.

    Each permission below carries its own example.

    interface Acl {
        create: boolean;
        delete: boolean;
        read: boolean;
        update: boolean;
    }
    Index

    Properties

    create: boolean

    Permission to create new objects of this type

    When true, the user is allowed to create new objects of this LimeType. This permission is only relevant on LimeType, not on LimeProperty.

    import { PlatformServiceName } from '@limetech/lime-web-components';

    const repository = platform.get(PlatformServiceName.LimeTypeRepository);
    const companyType = repository.getLimeType('company');

    if (companyType?.acl.create) {
    // show a "create new company" action
    }
    delete: boolean

    Permission to delete objects of this type, or to delete this property's value

    When true, the user is allowed to delete objects of the LimeType this ACL belongs to, or clear this LimeProperty's value.

    import { PlatformServiceName } from '@limetech/lime-web-components';

    const limetypes = platform.get(PlatformServiceName.LimeTypeRepository);
    const objects = platform.get(PlatformServiceName.LimeObjectRepository);

    const currentType = context.limetype
    ? limetypes.getLimeType(context.limetype)
    : undefined;

    if (currentType?.acl.delete && context.limetype && context.id) {
    await objects.deleteObject(context.limetype, context.id);
    }
    read: boolean

    Permission to read objects of this type, or read this property

    When true, the user is allowed to view objects of the LimeType this ACL belongs to, or view this LimeProperty's value.

    import { PlatformServiceName } from '@limetech/lime-web-components';

    const repository = platform.get(PlatformServiceName.LimeTypeRepository);

    // Types the user may not read are hidden entirely
    const visibleTypes = repository
    .getLimeTypes()
    .filter((limetype) => limetype.acl.read);
    update: boolean

    Permission to update objects of this type, or update this property

    When true, the user is allowed to modify objects of the LimeType this ACL belongs to, or modify this LimeProperty's value.

    import { PlatformServiceName } from '@limetech/lime-web-components';

    const repository = platform.get(PlatformServiceName.LimeTypeRepository);
    const property = repository.getLimeType('person')?.getProperty('name');

    // An editable input when the user may update, read-only text otherwise
    const fieldMode = property?.acl.update ? 'editable' : 'readonly';