Book a Demo

Author Topic: Store and access user data  (Read 13470 times)

michielper

  • EA User
  • **
  • Posts: 176
  • Karma: +2/-1
    • View Profile
Store and access user data
« on: June 21, 2021, 06:43:42 pm »
How can I store user data in an EA model so that project members and the scripts that they run can access this data?
This is e.g. relevant when project members run scripts that produce output in a user-specific folder.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Store and access user data
« Reply #1 on: June 21, 2021, 07:18:07 pm »
Can you be a bit more specific?
What type of exactly are you talking about, and what do you need to do with it?

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Store and access user data
« Reply #2 on: June 21, 2021, 07:19:30 pm »
One way would be to use the notes of the project root to store XML at your wish. It will be saved along with an XML export, so it's a good location. Also it's not directly visible to normal users (unless they can write and execute decent SQL).

q.

michielper

  • EA User
  • **
  • Posts: 176
  • Karma: +2/-1
    • View Profile
Re: Store and access user data
« Reply #3 on: June 21, 2021, 11:56:15 pm »
Can you be a bit more specific?
What type of exactly are you talking about, and what do you need to do with it?

Geert
Ok, what I mean is the following, rather simple. We are working on a common model in a team and we are using scripts for document generation. Sometimes we work with local copies of the central model (mainly for performance reasons). When we run a reporting scripts it lets us select the output folder via a simple dialog. Now, we would like the system (script) to remember the last output folder that we used as an individual so that next time it presents us this folder as default. So, not on a project-level but at an individual level.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Store and access user data
« Reply #4 on: June 22, 2021, 12:49:00 am »
Registry?

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Store and access user data
« Reply #5 on: June 22, 2021, 01:14:17 am »
Or you could store that in a user config file of some sorts.

I use something similar for my add-in settings. A file user.config gets written in the appdata folder.
See https://github.com/GeertBellekens/Enterprise-Architect-Add-in-Framework/blob/8e479616e96972ed369d81ab998cb8e556a22db5/EAAddinFramework/Utilities/AddinConfig.cs

Geert

michielper

  • EA User
  • **
  • Posts: 176
  • Karma: +2/-1
    • View Profile
Re: Store and access user data
« Reply #6 on: June 22, 2021, 05:16:55 pm »
Or you could store that in a user config file of some sorts.

I use something similar for my add-in settings. A file user.config gets written in the appdata folder.
See https://github.com/GeertBellekens/Enterprise-Architect-Add-in-Framework/blob/8e479616e96972ed369d81ab998cb8e556a22db5/EAAddinFramework/Utilities/AddinConfig.cs

Geert


Yes, but this requires me to have write-access to at least one hard coded location on the server that happens to run EA. I would prefer to have this data be part of the EA model. In the Repository Class there is a number of properties that are Collections and might be (mis)used for this (if they are not used for their intended purpose), e.g. Issues, ProjectRoles, Resources, Terms.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Store and access user data
« Reply #7 on: June 22, 2021, 06:13:27 pm »
So you want to remember the last output folder per user and per model?

I'm a bit confused because earlier you said: "So, not on a project-level but at an individual level."

I don't think it's a good idea to use one of these collections.
Probably safest to store the data you need in the form of an xml in a tagged value or a root element notes field or something similar

the xml data could be something like
Code: [Select]
<configs>
  <config userid="{EC1048AB-6359-4880-9C8C-E68C03229F50}>c:\temp\myOutputFolder\</config>
  <config userid="{3930C279-27AB-4c8f-A03C-65ADA435FD67}>c:\output\</config>
  <config userid="{C78E8EC0-DB56-4e9d-8156-416B5196F81C}>D:\data\myOutputFolder\</config>
</configs>

Geert

michielper

  • EA User
  • **
  • Posts: 176
  • Karma: +2/-1
    • View Profile
Re: Store and access user data
« Reply #8 on: June 23, 2021, 07:50:24 pm »
So you want to remember the last output folder per user and per model?

I'm a bit confused because earlier you said: "So, not on a project-level but at an individual level."

I don't think it's a good idea to use one of these collections.
Probably safest to store the data you need in the form of an xml in a tagged value or a root element notes field or something similar

the xml data could be something like
Code: [Select]
<configs>
  <config userid="{EC1048AB-6359-4880-9C8C-E68C03229F50}>c:\temp\myOutputFolder\</config>
  <config userid="{3930C279-27AB-4c8f-A03C-65ADA435FD67}>c:\output\</config>
  <config userid="{C78E8EC0-DB56-4e9d-8156-416B5196F81C}>D:\data\myOutputFolder\</config>
</configs>

Geert

A tagged value of some root element sounds like a good idea indeed. However, I ran into another problem: I cannot retrieve the user name or GUID because Security is not Enabled. We use a floating license and I do not know how then to enable security.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Store and access user data
« Reply #9 on: June 23, 2021, 07:58:13 pm »
Licensing is not related to model security.

You can enable it from the option Configure | Security | Administer | Enable Security

But if you don't want to do that you you could work with the windows user name as well.

Geert