Difference between Entity's Expose Read Only YES and NO

I saw this url.


I read "Set to Yes to expose the entity while protecting its data records from being written in a consumer module."


I would like to know concretely function difference and how to protect data records.

(Perhaps these are same.)


I'm beginner and I study web development.

Sorry for the stupid question.


Thanks.

Solution

Hi Erina,

If you set the ReadOnly  property to Yes for a Public entity, it means that the only entity action exposed is the Get<Entity>. All the the others like Update, Delete, etc. will only be available in the module in which the entity is defined.

This means that consumers can always query the entity (as it is public) by an aggregate, SQL or the Get<Entity> Action.

But to manipulate data (create, update, delete) it will only be possible for a consumer by public actions that you defined in the producer module (the one with the entity).

This is the way a producer module protects is data records written directly from consumer modules.

Regards,

Daniel 

Solution

Hi,

No problem :)


It's a matter of who "controls" the data.

If you set it to Public and ReadOnly, all consumers of that entity can only read the data.

This way, the module responsible for that entity is the owner of that data and the module has the power to change the data.


If you set it to Public and ReadOnly = false, every consuming module has access to the default action Create<Entity>, Delete<Entity> etc.

So, everybody can alter the data. This is normally what you don't want. because you have no idea what kind of data the consumer is altering or even deleting. perhaps you don't want that.


Concretely:

When you have an entity "Contracts", perhaps only the Legal-domain is allowed to change them, so you will have a Legal-application etc. etc. who controls the data.

So if you have a different application/module, for example "student insights" which are merely looking at exam-results of students.. you really don;t that application to be able to change contracts.

Hi Erina,

If you set your entity public and Expose Read Only to "Yes" and consume it from other module, you only will see the Get Entity Action. However, if you set Expose Read Only to "No" you will see all entity actions.

Example: I have two modules, "LearningSystem" is consuming the entity Issue from "LearningSystems_CS"

If i set Expose Read Only to "Yes" I only can use GetIssue

whereas if I set the property Expose Read Only to "No" I can access to all CRUD actions.

I hope I help you.

Good luck!

Regards.

Erina Yamazaki wrote:

I saw this url.


I read "Set to Yes to expose the entity while protecting its data records from being written in a consumer module."


I would like to know concretely function difference and how to protect data records.

(Perhaps these are same.)


I'm beginner and I study web development.

Sorry for the stupid question.


Thanks.

Hi Erina,

       When you create an entity then there are two property :-

1)Public :-  By default it set to No that means when you take that dependency on your consumer module then it will not be visible ...(it will only show that entity when you set public property set to Yes.)

2)Expose Read Only :-By default it set to Yes. If you create an entity and use that entity in the same module then it will show  all the entity actions which are by default created, however when you are using it in another module then it shows only getEntity action as shown in the screenshot. In this case when the entity is used in the consumer module we cannot manipulate the entity data.(like creating updating or deleting the records).

When you set that property to No then you will  get all the entity action in the consumer module and we are able to use that entity actions for the manipulation of the entity records.

NOTE: Keeping the expose read only to yes will secure your entity from manipulations, in this case in order to give  consumer the rights to manipulate the entity records then we can create server actions in the producer module itself and take that dependency.


I hope I help you.

Good luck!

Regards,

Yogesh Satpute