Make a section read only for some roles or userGroups

Hi there,

Have anyone solved the issue when it is required to make some section inside the stage make READ_ONLY for some roles or UserGroups?

for example there is roles A, B , C
inside the stage sections S1, S2, S3
I need to make READ_ONLY S1 for roles B&C

any suggestions?
Thank you

1 Like

I have program stages and inside the program stages there is a section I want to make read-only access to a specific section for roles, how can I do this, maybe someone has encountered such problems

1 Like

Hi @Ulanbek

It’s possible to control access to an entire program stage but I don’t think we can restrict access to only a specific section of the form within the program stage.

Instead of having one program stage, expand to PS1, PS2, PS3
Make PS1 ’ View Only’ for roles B&C

You can exchange data between program stages, so I hope this suggestion works?

Hi @Gassim

Thank you for your reply. I know program stages can be controlled by program rules and access control. But in my case I need to make some sections visible or read only for certain group of users.
If it is jot possible, I believe it could be great functionality in the future

Regards,
Ulanbek

1 Like

Hi @Ulanbek & @dino_dhis

Would you like to create a feature request ticket? Please make sure to give it more context and why it’s important for the implementation.

If you do, please share the link to the ticket here so others in the community who need this feature can comment. watch, and add their vote.

Thanks!

1 Like

Hi @Ulanbek
May be this will not be usable in your case (depending the number of Data elements in the program stage) but i recently used a workaround with a program rule doing 2 actions if the user does not have the required role to edit:

  1. 1 Action to Hide the section
  2. 1 action to display Text in the program Indicator widget using expressions with variables to display the values of the DE.
    I did not yet test it on Android app, but for capture Web app, this is working.
1 Like

Hi @gregory

I have few stages, which I can hide on user group base. But to make a section read only is different.

I have something on my mind. Let’s check

Thank you

1 Like

Hi @gregory
Thanks for your input!

Would you share which expression you used to check the role in the program rule?

Thank you!! :slight_smile:

Usually expression is d2:hasUserRole(‘UserRole_UID’)

1 Like

You are right, and I used exactly : !d2:hasUserRole(‘Role_UID for editing the section’)

1 Like

Ah, right, I forgot! Thank you for the reminder ! :slight_smile:

I think @gregory’s suggestion should work to control access for sections since we can figure out that users have role B & C. However, there isn’t a “make read only” action:

That’s the point @Gassim :point_up:
Otherwise I would not have to create this topic :grin:

2 Likes

Hi again!

So I think we can create a feature request? Would you like to create one and share it here: jira.dhis2.org? If you’d like, I can create it on your behalf. Thanks!

Hi @Gassim

I believe it will really useful. Thank you @Gassim for your support

Regards,
Ulanbek

1 Like

@Gassim I agree with Ulanbek, and a read only feature for form sections would be really great for our use cases, instead of displayting the content in a feedback widget (which does not seem to work on android app)

Kindly share the link whenever available so that we can upvte for this feature.

Thanks in advance

1 Like

Thanks @Ulanbek and @gregory ! I’m following up with @dhis2-tracker about creating this as a feature request.

@gregory, one question please, you mentioned: "

I confirmed with @dhis2-android team that “The feedback from program rules are displayed in the analytics tabs in events or tei dashboard. If it is not displaying it may be an issue with the rule expression.”(@Pablo)

Would you kindly create a new topic explaining how the feedback widget isn’t working for you in the android app? A new topic with your use case and program rule expression will help with discussing this issue seperately. And specifically so we can see if there’s an issue that can be reproduced or a correction in the rule expression please.

Thanks ahead!

A post was split to a new topic: Android Capture app: d2:concatinate program rule to show feedback