Book a Demo

Author Topic: EA.Repository.OpenFile asks for password, ProjectTransfer fails  (Read 9284 times)

siaccarino

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-1
    • View Profile
Hello,

Prerequisites:
  • EA v12 DB on a MySQL server
  • Windows domain
  • Model security is enabled
  • Users are added with their windows domain credentials
  • Special user with password added
  • Special user without password added
  • Export console tools are written in C# .NET 4.6.2

Now I want create some Jenkins build jobs that automatically export data.

On my local machine I can call (C#)
  OpenFile(connectionString)
or
  ProjectTransfer(connectionString, eapFileName, logFileName)
without any issues.

On every other machine within our domain everything leads to a dialog to enter a password (only password, no username) no matter if I set SuppressSecurityDialog to true or not. But they can open the DB without entering credentials with EA application.

  • OpenFile(connectionString) - user domain credentials seems to be ignored
  • OpenFile2(connectionString,specialUserWithoutPassword,"") - this user does NOT have a password!
  • OpenFile2(connectionString,specialUserWithPassword,password) - password is ignored!

And ProjectTransfer fails completely with an DB exception.

For me it looks like the EA COM connection (Interop.EA) always tries to connect with current user account - even in OpenFile2() - and it fails to evaluate user credentials then.
« Last Edit: August 16, 2018, 05:49:42 pm by siaccarino »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA.Repository.OpenFile asks for password, ProjectTransfer fails
« Reply #1 on: August 16, 2018, 06:05:27 pm »
The password dialog you are getting is EA's equivalent of "could not connect to the database". :-\
Try disabling the network, and you'll see the same thing.

There probably is an issue with the connection string you are using.

Geert

siaccarino

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-1
    • View Profile
Re: EA.Repository.OpenFile asks for password, ProjectTransfer fails
« Reply #2 on: August 16, 2018, 07:33:11 pm »
Yes - the connection string was the issue.

Now I have a second issue:
I want to dump the model into a eap file.
Security is enabled
The dump shall not have security
I copied an empty DB (EA -> File -> New Project -> Save -> Quit) with disabled security to the target directory.

ProjectTransfer fails:
Data Transfer Failed due to any of the following reasons
1. Source File is not existing
2. Target File is already existing
3. Target File is not an EAP File because Target should be an EAP in AI


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA.Repository.OpenFile asks for password, ProjectTransfer fails
« Reply #3 on: August 16, 2018, 07:51:10 pm »
It fails because of 2. Target File is already existing
You don't need an empty .eap file for the project transfer using the API.

Geert

siaccarino

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-1
    • View Profile
Re: EA.Repository.OpenFile asks for password, ProjectTransfer fails
« Reply #4 on: August 16, 2018, 07:54:21 pm »
But how to disable security in the dump?

if (eaFile.OpenFile(eapFileName))
    eaFile.Execute("DELETE FROM t_secpolicies");

works but asks for an EA user login (although I am DB admin with windows domain credentials)

The purpose is to have a snapshot where the people can do experiments - but it won't be accessible with windows domain credentials
« Last Edit: August 16, 2018, 07:56:53 pm by siaccarino »

siaccarino

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-1
    • View Profile
Re: EA.Repository.OpenFile asks for password, ProjectTransfer fails
« Reply #5 on: August 16, 2018, 08:25:14 pm »
In http://www.sparxsystems.com/forums/smf/index.php/topic,26559.msg206987.html#msg206987 you said :
"Workaround: turn off security in the target database before transferring"

But who shall this work when  TransferFile fails with existing target database

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA.Repository.OpenFile asks for password, ProjectTransfer fails
« Reply #6 on: August 16, 2018, 08:40:27 pm »
You'll have to turn off security "after transferring to .eap file.

I don't know by heart where this setting is located in the database, but once turned off you should not get any log-in prompts anymore.
You should be able to find it if you turn on the profiler on SQL server and then do it manually.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: EA.Repository.OpenFile asks for password, ProjectTransfer fails
« Reply #7 on: August 16, 2018, 08:52:20 pm »
It's the "Enable Security" once again. The label reads Enable but when it's enabled it disables security. Where's the National Guard, when you actually need it??

q.

siaccarino

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-1
    • View Profile
Re: EA.Repository.OpenFile asks for password, ProjectTransfer fails
« Reply #8 on: August 16, 2018, 08:57:52 pm »
Disabling after transfer has a major drawback:
windows domain credentials wont work for the transferred file.
This implies that I have to create a special account in EA that is later used to switch security off.
This implies that I have to pass this account data to the transfer tool - it becomes visible in the Jenkins job - or I have to hard code it into the tool.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA.Repository.OpenFile asks for password, ProjectTransfer fails
« Reply #9 on: August 16, 2018, 09:25:39 pm »
Or you could
- disable security
- transfer model
- enable security

But that would leave your model open without requesting logins for the time it requires to transfer the model.

I'm not so sure creating a special user is such a bad idea. If you have security on your database based on windows authentication, then that will protect your model from unauthorized access, regardless of EA users.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: EA.Repository.OpenFile asks for password, ProjectTransfer fails
« Reply #10 on: August 16, 2018, 10:19:38 pm »
To create an empty un-secured EAP you just use a file copy from the base model in EAP's program directory.

q.