I’d like to be able to make one of the web endpoints read-only. Is that possible without going through security/roles?
There are some other web endpoints that I would like to make specific fields read-only as well. Is there a way to do that? I could make a non-persisted field that mirrors the value of the field I want to display and expose that in the endpoint. I’m wondering if I’ve overlooked something.
Certainly using Roles to restrict which entities the API user can write would work. Having specific fields read only requires customizing the screen to prevent setting a value. Something like:
protectedvoid _(Events.RowUpdating<DAC> e)
{
// If you want to validate only the REST API callif(Base.IsContractBasedAPI && e.Row.Field != e.NewRow.Field)
{
thrownew PXException("ERROR: FIELD READ ONLY") ;
}
}
Certainly using Roles to restrict which entities the API user can write would work. Having specific fields read only requires customizing the screen to prevent setting a value. Something like:
protectedvoid _(Events.RowUpdating<DAC> e)
{
// If you want to validate only the REST API callif(Base.IsContractBasedAPI && e.Row.Field != e.NewRow.Field)
{
thrownew PXException("ERROR: FIELD READ ONLY") ;
}
}
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.