Hi,
I want to restrict the creation of entities in my CDS service. Only users that are assigned to the 'create' scope should be able to insert a new record. I want the '+' Button in the ListView disabled or invisible.
I annotated my entity as follows (according to this documentation https://github.com/oasis-tcs/odata-vocabularies/blob/master/vocabularies/Org.OData.Capabilities.V1.md#InsertRestrictionsType):
entity BusinessPartnerGroup @(
Capabilities: {
InsertRestrictions: {Insertable: true, Permissions: [Scopes: [{Scope: 'create'}]]},
UpdateRestrictions: {Updatable: true},
DeleteRestrictions: {Deletable: false}
},
restrict: [
{ grant: ['READ'], to: 'read' },
{ grant: ['CREATE'], to: 'create' },
{ grant: ['WRITE'], to: 'update' },
]
) as projection on ds.BusinessPartnerGroup {
When compiling I get the following errors:
[ERROR] srv/BusinessPartner-service.cds:17:86-87: Extraneous ',', expecting ';', '@', ABSTRACT, ACTION, ANNOTATE, ANNOTATION, ASPECT, CONST, CONTEXT, DEFINE, ENTITY, EVENT, EXTEND, FUNCTION, SERVICE, TABLE, TEMPORARY, TYPE, USING, VIEW, <EOF>
[ERROR] srv/BusinessPartner-service.cds:17:83-84: Extraneous ']', expecting ';', '@', ABSTRACT, ACTION, ACTIONS, ANNOTATE, ANNOTATION, ASPECT, CONFIGURATION, CONST, CONTEXT, DEFINE, ENTITY, EVENT, EXTEND, FUNCTION, HANA, SERVICE, TABLE, TECHNICAL, TEMPORARY, TYPE, VIEW
[ERROR] srv/BusinessPartner-service.cds:18:41-42: Mismatched ',', expecting <EOF>
[ERROR] srv/BusinessPartner-service.cds:17:63-64: Mismatched ':', expecting ',', '.', ']'
[ERROR] srv/BusinessPartner-service.cds:17:74-82: Mismatched String, expecting Identifier, '{', ARRAY, ASSOCIATION, COMPOSITION, LOCALIZED, MANY, TYPE
Any ideas?