About Jack

Hi CUBA team,

I am learning using High productivity application development platform

Up to OrderService. When I login as jack, set the hoursSpent, add some parts and click OK. The amount will not update. It will update if I perform using account admin. The amount has been set as Hide inside Mechanics role. But I can only tick either Modify or Hide. Is this default? Possible to update the Amount even it is hidden?

Thanks for helping up.

Hi Adam,

thank you for your question. It seems it is a small issue of our Hands On Lab script.

Now CUBA does not load hidden (by security permission) attributes and amount will not be updated from a screen if user does not have permission to change it. If you don’t have desktop client in your project you can safely set in your app.properties of core module:


cuba.entityAttributePermissionChecking = false

Also you can change it from a running application using Administration - Application Properties screen.

1 Like

Thanks Yuriy Artamonov,

The Hands On Lab quick start are good.

In addition, the desktop client is part of my plan so the app.properties is not suitable for me.

Is there other way round? Not loading a Hidden attribute is definitely correct.

I have read [url=https://doc.cuba-platform.com/manual-6.2/dm_vs_em.html]https://doc.cuba-platform.com/manual-6.2/dm_vs_em.html[/url]

EntityManager doesn’t impose security restriction and it is stayed inside middle tier.

I guess it should be ok to use EntityManager inside OrderServiceBean to update the amount right?

Normally,

  1. sales staff (can’t see amount) create order (status = new)
  2. mechanic (can’t see amount) update order (status from in_progress to ready) (amount not change)
  3. billing staff (can see amount) update order (status = invoiced) (amount auto updated)
  4. invoiced order cannot be update anymore

but if follow ERP style

  1. sales staff (can’t see amount) create order (status = new)
  2. mechanic (can’t see amount) update order (status from in_progress to ready) (amount auto update)
  3. billing staff (can see amount) post order which create invoice and cause auto update order (status = invoiced) (amount not change)
  4. invoiced order cannot be update anymore

This is because managers like to request readied orders (or non-invoiced orders) with the amounts report to do some planning. If the amount cannot update when mechanic set status to ready, then the order amount might not accurate. Or else the report query will need to calculate the orders 1 by 1 thus give pressure to the server.

No, you should not update amount of order from OrderService before it has been saved, it will lead to optimistic locking situation.

You are right, in real applications such a business logic of changing statuses and amounts should be moved to middleware. In case of CUBA applications you can move your code to a standalone service or an entity listener ([url=https://doc.cuba-platform.com/manual-6.2/entity_listeners.html]https://doc.cuba-platform.com/manual-6.2/entity_listeners.html[/url]).

The second option is more suitable for status/amount option.

1 Like