cancel
Showing results for 
Search instead for 
Did you mean: 

ACA Making properties read only

fedorow
Elite Collaborator
Elite Collaborator

Project Alfresco Content Application

I'm trying to extend Content Metadata Card with custom groups and can't make property readonly.

The changers of app.config.json file by documentation do not work,

and changers of app.extensions.json file by forum thread do not works too. 

app.extensions.json:

    "content-metadata-presets": [
      {
        "id": "app.content.metadata.custom",
        "custom": [
          {
            "id": "app.content.metadata.customSetting",
            "includeAll": true,
            "readOnlyProperties": [
              "myprefix:category",
              "myprefix:family",
              "myprefix:natura"
            ],
            "exclude": [
              "rn:renditioned",
              "cm:versionable",
              ...

app.config.json

  "content-metadata": {
    "presets": {
      "custom": [
        {
          "includeAll": true,
          "readOnlyProperties": [
            "myprefix:family",
            "myprefix:natura"
          ],
          "exclude": [
            "rn:renditioned",
            ...

To be honest, I tried place readOnlyProperties in every thread of custom preset in both files and separately.

What can I do?

1 ACCEPTED ANSWER

fedorow
Elite Collaborator
Elite Collaborator

The "readOnlyProperties" did not work for me.

So I did workaround by using "editable": false parameter. Now group contains two items with same aspect. First item is editable, second item isn't.

...
"content-metadata-presets": [
  {
    "id": "app.content.metadata.custom",
    "custom": [
      {
        "title": "TRANSLATABLE_TITLE_FOR_GROUP_1",
        "items": [
          { 
            "id": "",
            "aspect": "myprefix:aspect", 
            "properties": [
              "myprefix:myEditableProperty1",
              "myprefix:myEditableProperty2"
            ]
          },
          { 
            "aspect": "myprefix:aspect", 
            "properties": [
              "myprefix:category",
              "myprefix:family",
              "myprefix:natura"
            ],
            "editable": false
          }
        ]
      }
    ]
  }
]
...

View answer in original post

3 REPLIES 3

angelborroy
Content Contributor
Content Contributor

Did you follow these steps?

https://alfresco-content-app.netlify.app/#/tutorials/content-metadata

Hyland Developer Evangelist

fedorow
Elite Collaborator
Elite Collaborator

Angel thanks for respond!

Yes I did it. Everything from tutorial works fine: creating group, includeAll, exclude, create list of properties from several asspects.

But there is nothing about readonly in the tutorial. Now I hide properties. But I want to show their values in read only mode.

fedorow
Elite Collaborator
Elite Collaborator

The "readOnlyProperties" did not work for me.

So I did workaround by using "editable": false parameter. Now group contains two items with same aspect. First item is editable, second item isn't.

...
"content-metadata-presets": [
  {
    "id": "app.content.metadata.custom",
    "custom": [
      {
        "title": "TRANSLATABLE_TITLE_FOR_GROUP_1",
        "items": [
          { 
            "id": "",
            "aspect": "myprefix:aspect", 
            "properties": [
              "myprefix:myEditableProperty1",
              "myprefix:myEditableProperty2"
            ]
          },
          { 
            "aspect": "myprefix:aspect", 
            "properties": [
              "myprefix:category",
              "myprefix:family",
              "myprefix:natura"
            ],
            "editable": false
          }
        ]
      }
    ]
  }
]
...