Hello,
I would like the field to be unavailable for editing. and that only users who have permission can change
How can help me??
Hello
In the Enable Property of you Input field you have to check the Role,
So first you need to create Role then you need to give the roles to that user or group of users whom you want access to edit the input field, So if you only want to give the read-only access then Check the Role in the Enable property of your Input. Ex:
if(IsAdmin,True,False)I am attaching some reference link that will help you with check role functionality
https://www.outsystems.com/forums/discussion/78410/how-to-give-visibility-of-container-widgets-and-button-widget-based-on-roles/
Since we have a lot of similar Post you can refer to them here:https://www.outsystems.com/forums/Search.aspx?page=1&q=Check+Role&scat=forums
Hope this helps ThanksTousif Khan
Hi @Pedro Faria ,
For enabling/disabling a field, you have the Enabled property that you seem to be already using, where you can provide a specific condition.
I'm assuming you are managing your user permissions through the use of roles.
In that case, you can create a data action in your screen, called GetRoles, where you call the checkRole for the current user (getUserId()), and return a boolean as output, stating if the user has that role or not.After that, you can just use that output on your enabled property of your field.
Let me know if this helps!
Cheers,
Paulo
@Pedro faria
Hi,
you can enable or disable field as per requirement by just putting specific condition in enabled Property of field.
In enabled property of particular field check role of user who ever login.
@Vikram garasiya , the whole point is that he cannot use default checkrole functions on input client-side property.
So @Paulo Ritto, what he can do is firstly he will check the role of user who ever login and take it in Boolean type variable and based on that variable he can do so.
It's possible to use the Data Action approach, that returns true i the user has the role, false otherwise, as the data action is executed server side and the Check<role>Role works there.
But then, it has to be done on every screen where it is needed.
I prefer the Client Action approach, where you run a small javascript code that returns if the user has the role. This way, you can create a generic function that check the role client side and can be used on the Initialization event, for example, while the data action can't.https://visualcodify.com/2021/06/26/outsystems-role-based-security-on-screen/
However, one must not forget that everything client-side can be tampered with, so you do need checks server side when saving data.
Hi Pedro,
There's multiple things you can do. As others have already suggested, you can check the Role and toggle the Enabled property based on that. As an alternative, you could either use an If to replace the Form with inputs for static text, or use multiple Ifs to replace each input box for static text.
Note that since it's Reactive, all checks are done client-side and can be tampered with, so make sure that all Save actions server-side also check the Role!
I tried to do it that way, but I couldn't
Can help me?
Can you please share your OML so I can take reference
Please see the attachement it will help you to clear your senario