User resource - management doubts

14 views
Skip to first unread message

Łukasz Lewczyński

unread,
Jun 15, 2018, 1:39:13 AM6/15/18
to OpenLMIS Dev, Josh Zamor, Chongsun Ahn, Sebastian Brudziński
Hi all,

When we complete  OLMIS-4896OLMIS-4833 and OLMIS-4902 we will have three user resources in three different services:
  1. auth's user resource that contain details like username, password and enabled flag
  2. reference data's user resource that contain details like first/last name, jot title, etc.
  3. user's contact details in the notification service
The problem that could occur is how to manage those resources in such way to avoid data inconsistent.

I thought about this a little bit and I would like to show you my propositions:

Each sub-resource is independent
Current approach is that all resources are connected and they have to be created in the same time. Also from the end user perspective there is a single form that contain fields from all resources. We could change that by saying if there is entry in the auth service then user is created, the user can use the system and there is no need to create the rest of resources. If the user decides to create a profile by putting data into the reference data service then the user simple submit a profile form (from UI perspective) or execute correct endpoint in the service (from API perspective). Same for contact details.

With this approach each resource would be created by endpoints in the related service. Currently we use only the auth endpoint and the reference data endpoint is executed by the auth service.

The main issue is that all of our services retrieve current user from the reference data and they ignore resource from the auth service. We probably will have to change that. Also we would need to provide extra checks for some actions. For example we could not assume that there is a related entry in the notification service with contact details.

Single endpoint for save, many endpoints for update
In this approach we still treat all resources as a single user but we divide create/update actions. In other words:
  • To create a user the POST endpoint from the auth service would be executed. The endpoint is responsible for putting data into related services. The problem can be correct handling of a situation where sub-resource has been created in one service but there was an error is another service. We probably should execute DELETE endpoint but it could also cause errors.
  • To update user the PUT endpoint of the service that keep sub-resource is executed. This is easier to explain from UI perspective because we will have to add update buttons next to each data section. This could be problematic if we would use a single view because user could have problem to understand which update button should be used so it probably be a good to divide sections by tabs

The auth service controls the user resource
We stay with the current approach so the create/update request is handled by the auth service and we provide extra endpoints to the service for other actions on the user. In other words if a user want to execute ANY action on the user resource the user has to use one of the endpoints from the auth service.

Thanks that we have to know only about single service, UI is slightly simplified. Main problem? Endpoints duplication because each non auth action would cause adding extra endpoint to the auth service to give access for a user.

I hope you understand my point of view about managing the user resource in the system after we complete the tickets that were mention on the beginning of this message. If you have any questions, suggestions or you think that we could handle that differently please let me know in this topic. If there will be a need we could discuss this on Technical Committee meeting.

Regards,
Lukasz

Łukasz Lewczyński
Software Developer
llewc...@soldevelo.com


SolDevelo
Sp. z o.o. [LLC] / www.soldevelo.com
Al. Zwycięstwa 96/98, 81-451, Gdynia, Poland
Phone: +48 58 782 45 40 / Fax: +48 58 782 45 41

Nikodem Graczewski

unread,
Jun 15, 2018, 3:02:29 AM6/15/18
to Łukasz Lewczyński, OpenLMIS Dev, Josh Zamor, Chongsun Ahn, Sebastian Brudziński
Hi Łukasz,

To me, the first approach feels the most reasonable and best conforming the micro-service architecture of our system. I'm curious about what would we use for identifying which of the resources relate to the same user. We wouldn't be able to reference user id from the reference data service as it wouldn't be always available. Would we replace it with authUserId? Wouldn't it make notification and reference data dependable on it? How would it fit in our architecture?

Best regards,
Nikodem

Nikodem Graczewski
Software Developer


--
You received this message because you are subscribed to the Google Groups "OpenLMIS Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openlmis-dev+unsubscribe@googlegroups.com.
To post to this group, send email to openlm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openlmis-dev/CAAdp53wLW5TFKqE1ex7cPQmTyM9jnkJPgqadHp3jFpBNVq78FA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Łukasz Lewczyński

unread,
Jun 15, 2018, 3:12:09 AM6/15/18
to Nikodem Graczewski, OpenLMIS Dev, Josh Zamor, Chongsun Ahn, Sebastian Brudziński
Hi Nikodem,

Currently I made that the auth's user and the reference data's user has the same id field because of issue related with data consistent when user is saved/updated. We could do the same here all three sub-resources would have the same id field so it would be easy to manage them.

I called this approach as "each resource is independent" but in reality the auth resource is needed because otherwise user could not log into the system.


Łukasz Lewczyński
Software Developer
llewc...@soldevelo.com

To unsubscribe from this group and stop receiving emails from it, send an email to openlmis-dev...@googlegroups.com.


SolDevelo
Sp. z o.o. [LLC] / www.soldevelo.com
Al. Zwycięstwa 96/98, 81-451, Gdynia, Poland
Phone: +48 58 782 45 40 / Fax: +48 58 782 45 41

Chongsun Ahn

unread,
Jun 22, 2018, 5:02:32 PM6/22/18
to Łukasz Lewczyński, OpenLMIS Dev
Hey Łukasz,

I think the first option of “each resource is independent” makes the most sense. However, I don’t think the system would be usable for a user that is not saved in reference data either, since many other services consult user info from reference data.

Shalom,
Chongsun

-- ​
There are 10 kinds of people in this world; those who understand binary, and those who don’t.

Software Development Engineer
 
VillageReach Starting at the Last Mile
2900 Eastlake Ave. E, Suite 230,  Seattle, WA 98102, USA
DIRECT: 1.206.512.1536   CELL: 1.206.910.0973   FAX: 1.206.860.6972
SKYPE: chongsun.ahn.vr
Connect on Facebook, Twitter and our Blog

Josh Zamor

unread,
Jun 25, 2018, 4:44:26 AM6/25/18
to OpenLMIS Dev
I'm not sure I'm following this, and my internet isn't good enough to load everything, however I think I agree with what you've laid out in option 1, with a big caveat:  The user is not owned by the Auth service.

Lets step back a second and think about the role of each of these services:
- Reference Data owns the canonical definition of meta-data.
- Auth owns credentials and the workflow of obtaining new credentials (i.e. forgot password reset).
- Notification Service hasn't owned anything recently, except the definition of a channel ignorant Notification.  Channel here means things like email, SMS, voice/IVR, in-app push, etc.  Except for email the rest of the channels are aspirational at this point.

Given this, when it comes to a User I would expect:
- Reference Data continues to own the canonical definition of a User.  i.e. you can't have a User, without having an entry in Reference Data.
- Auth continues to own credentials:  Passwords, Service credentials, etc.
- Notification should continue to own a Notification, and I think it should own contact information (e.g. someone's email address, phone number, etc).

With this breakdown, the actions should be separate:  I can mutate a User, separate from mutating a person's Credentials or contact information.  In-fact I should be able to have a User without credentials or contact information.  I should not be able however to have a User's Credentials, without a User.  That level of logical inconsistency isn't terribly difficult to deal with (fail valid User credentials where there's no longer a valid User), and can be cleaned up with a batch job at some later date.

Perhaps I misread something here, but I did want to be sure that Reference Data keeps owning the definition of a User and the majority of their canonical Profile, and that the other Service should own additional resources that add-on to that canonical definition.

Best,
Josh


On Saturday, June 23, 2018 at 12:02:32 AM UTC+3, chongsun.ahn wrote:
Hey Łukasz,

I think the first option of “each resource is independent” makes the most sense. However, I don’t think the system would be usable for a user that is not saved in reference data either, since many other services consult user info from reference data.

Shalom,
Chongsun

-- ​
There are 10 kinds of people in this world; those who understand binary, and those who don’t.

Software Development Engineer
 
VillageReach Starting at the Last Mile
2900 Eastlake Ave. E, Suite 230,  Seattle, WA 98102, USA
DIRECT: 1.206.512.1536   CELL: 1.206.910.0973   FAX: 1.206.860.6972
SKYPE: chongsun.ahn.vr
Connect on Facebook, Twitter and our Blog
On Jun 15, 2018, at 12:11 AM, Łukasz Lewczyński <llewc...@soldevelo.com> wrote:

Hi Nikodem,

Currently I made that the auth's user and the reference data's user has the same id field because of issue related with data consistent when user is saved/updated. We could do the same here all three sub-resources would have the same id field so it would be easy to manage them.

I called this approach as "each resource is independent" but in reality the auth resource is needed because otherwise user could not log into the system.

Łukasz Lewczyński
Software Developer
llewc...@soldevelo.com


On Fri, Jun 15, 2018 at 9:02 AM Nikodem Graczewski <ngrac...@soldevelo.com> wrote:
Hi Łukasz,

To me, the first approach feels the most reasonable and best conforming the micro-service architecture of our system. I'm curious about what would we use for identifying which of the resources relate to the same user. We wouldn't be able to reference user id from the reference data service as it wouldn't be always available. Would we replace it with authUserId? Wouldn't it make notification and reference data dependable on it? How would it fit in our architecture?

Best regards,
Nikodem

Nikodem Graczewski
Software Developer

To unsubscribe from this group and stop receiving emails from it, send an email to openlmis-dev+unsubscribe@googlegroups.com.
To post to this group, send email to openlmis-dev@googlegroups.com.


SolDevelo
 Sp. z o.o. [LLC] / www.soldevelo.com
Al. Zwycięstwa 96/98, 81-451, Gdynia, Poland
Phone: +48 58 782 45 40 / Fax: +48 58 782 45 41



SolDevelo
 Sp. z o.o. [LLC] / www.soldevelo.com
Al. Zwycięstwa 96/98, 81-451, Gdynia, Poland
Phone: +48 58 782 45 40 / Fax: +48 58 782 45 41


-- 
You received this message because you are subscribed to the Google Groups "OpenLMIS Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openlmis-dev+unsubscribe@googlegroups.com.
To post to this group, send email to openlmis-dev@googlegroups.com.

Łukasz Lewczyński

unread,
Jun 25, 2018, 5:15:07 AM6/25/18
to Josh Zamor, Chongsun Ahn, OpenLMIS Dev
Hi Josh and Chongsun,

Thanks for replies. I would like to make sure that I understand correctly:
* reference data's User resource is mandatory
* auth's and notification's resources depends on above resource
* all three resources should be handle by endpoints that are in the same service as resource

If those assumptions are correct, I will create an epic to change current approach in which all create/update requests must go though the auth service.

Regards,
Lukasz

Łukasz Lewczyński
Software Developer
llewc...@soldevelo.com

On Mon, Jun 25, 2018 at 10:44 AM Josh Zamor <josh....@villagereach.org> wrote:
I'm not sure I'm following this, and my internet isn't good enough to load everything, however I think I agree with what you've laid out in option 1, with a big caveat:  The user is not owned by the Auth service.

Lets step back a second and think about the role of each of these services:
- Reference Data owns the canonical definition of meta-data.
- Auth owns credentials and the workflow of obtaining new credentials (i.e. forgot password reset).
- Notification Service hasn't owned anything recently, except the definition of a channel ignorant Notification.  Channel here means things like email, SMS, voice/IVR, in-app push, etc.  Except for email the rest of the channels are aspirational at this point.

Given this, when it comes to a User I would expect:
- Reference Data continues to own the canonical definition of a User.  i.e. you can't have a User, without having an entry in Reference Data.
- Auth continues to own credentials:  Passwords, Service credentials, etc.
- Notification should continue to own a Notification, and I think it should own contact information (e.g. someone's email address, phone number, etc).

With this breakdown, the actions should be separate:  I can mutate a User, separate from mutating a person's Credentials or contact information.  In-fact I should be able to have a User without credentials or contact information.  I should not be able however to have a User's Credentials, without a User.  That level of logical inconsistency isn't terribly difficult to deal with (fail valid User credentials where there's no longer a valid User), and can be cleaned up with a batch job at some later date.

Perhaps I misread something here, but I did want to be sure that Reference Data keeps owning the definition of a User and the majority of their canonical Profile, and that the other Service should own additional resources that add-on to that canonical definition.

Best,
Josh


On Saturday, June 23, 2018 at 12:02:32 AM UTC+3, chongsun.ahn wrote:
Hey Łukasz,

I think the first option of “each resource is independent” makes the most sense. However, I don’t think the system would be usable for a user that is not saved in reference data either, since many other services consult user info from reference data.

Shalom,
Chongsun

-- ​
There are 10 kinds of people in this world; those who understand binary, and those who don’t.

To unsubscribe from this group and stop receiving emails from it, send an email to openlmis-dev...@googlegroups.com.
To post to this group, send email to openlm...@googlegroups.com.


SolDevelo
 Sp. z o.o. [LLC] / www.soldevelo.com
Al. Zwycięstwa 96/98, 81-451, Gdynia, Poland
Phone: +48 58 782 45 40 / Fax: +48 58 782 45 41



SolDevelo
 Sp. z o.o. [LLC] / www.soldevelo.com
Al. Zwycięstwa 96/98, 81-451, Gdynia, Poland
Phone: +48 58 782 45 40 / Fax: +48 58 782 45 41


-- 
You received this message because you are subscribed to the Google Groups "OpenLMIS Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openlmis-dev...@googlegroups.com.
To post to this group, send email to openlm...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "OpenLMIS Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openlmis-dev...@googlegroups.com.
To post to this group, send email to openlm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openlmis-dev/157a65b7-96e6-401f-87b5-8fe3346d6225%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Josh Zamor

unread,
Jun 25, 2018, 5:19:10 AM6/25/18
to Łukasz Lewczyński, Chongsun Ahn, OpenLMIS Dev
Thanks Lukasz, that sounds correct.  Please update the epic.



Łukasz Lewczyński

unread,
Jun 25, 2018, 5:44:49 AM6/25/18
to Josh Zamor, Chongsun Ahn, OpenLMIS Dev
The epic OLMIS-4983 has been created. Soon there will be tickets.


Łukasz Lewczyński
Software Developer
llewc...@soldevelo.com

Reply all
Reply to author
Forward
0 new messages