Author Topic: "Apply Locks to Connectors" option - how to disable  (Read 2966 times)

Ian Mitchell

  • EA User
  • **
  • Posts: 506
  • Karma: +22/-4
  • The eaDocX and Model Expert guy
    • View Profile
"Apply Locks to Connectors" option - how to disable
« on: May 05, 2022, 11:42:49 pm »
Has anyone found where the option "Apply Locks to Connectors" is stored?
 
It's a really useful feature, and I just need to switch it off for a couple of seconds (from an add-in), then I'll put it right back where I found it - honest...
Ian Mitchell, Designer, eaDocX


www.eaDocX.com
www.theartfulmodeller.com

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13241
  • Karma: +554/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: "Apply Locks to Connectors" option - how to disable
« Reply #1 on: May 06, 2022, 12:09:30 am »
This is what I see in the SQL Server profiler when I check that option:

Code: [Select]
exec sp_executesql N'INSERT INTO "EA_Training".."t_secpolicies" ("Property","Value") VALUES (@P1,@P2)',N'@P1 nvarchar(14),@P2 nvarchar(1)',N'LockConnectors',N'1'
In other words, in the table t_secpolicies, in the record with the Property 'LockConnectors'.

Now the thing is, that EA will probably load those policies in memory when loading a model. So if you change it in the database behind EA's back, you'll probably need to reload the model before it has any effect.

Geert

Ian Mitchell

  • EA User
  • **
  • Posts: 506
  • Karma: +22/-4
  • The eaDocX and Model Expert guy
    • View Profile
Re: "Apply Locks to Connectors" option - how to disable
« Reply #2 on: May 06, 2022, 12:17:29 am »
Thanks Geert - probably not something which I can do quietly.
Plan B.....
If I intercept the 'On Connector Delete' event, I can re-implement a 'you can't do that ' method just fine,  but how to stop naughty users - who notice that Connector security is OFF - from accidentally editing 'locked' connectors  - that is, connectors between elements which are themselves locked.

Plan C
I'm thinking that maybe I'll fix the problem at source, and instead of using the API to create a connector to a locked element, just use SQL to do it instead.
Ian Mitchell, Designer, eaDocX


www.eaDocX.com
www.theartfulmodeller.com

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13241
  • Karma: +554/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: "Apply Locks to Connectors" option - how to disable
« Reply #3 on: May 06, 2022, 12:34:09 am »
Plan C
I'm thinking that maybe I'll fix the problem at source, and instead of using the API to create a connector to a locked element, just use SQL to do it instead.
That's even naughtier. :o

I try to avoid that as much as possible. Maybe you can fool EA by first making a connector between two other (dummy?) elements, and then changing source and target ID's.
I have a dark brown suspicion that EA will not stop you, even if the source and target ID's belong to locked elements.

But even if they do, it's much easier to use SQL to update an existing connector, than it is to insert a new record into t_connector correctly.

Geert

Ian Mitchell

  • EA User
  • **
  • Posts: 506
  • Karma: +22/-4
  • The eaDocX and Model Expert guy
    • View Profile
Re: "Apply Locks to Connectors" option - how to disable
« Reply #4 on: December 07, 2022, 03:52:39 am »
You were, of course, correct.
What made it work was to
(1) Do as you sugested, and create a dummy element, and use that to create a connector (using SQL proved too hard), then
(2) use SQL to update the t_Connector.Start_Object_ID.

Updating that connector through the API also caused a failure due to the element being locked, which I guess is good, as it means the API is accurate in applying the locking rules.
So a SQL UPDATE made it work.
I suppose I should expect this kind of solution when I'm doing such naughty things.
Ian Mitchell, Designer, eaDocX


www.eaDocX.com
www.theartfulmodeller.com

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8595
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: "Apply Locks to Connectors" option - how to disable
« Reply #5 on: December 07, 2022, 09:18:01 am »
As that famous quote from (I think) "Dick Emery" says...   "Ooh!  You are awful, but I like you". https://www.facebook.com/watch/?v=1673979482717740

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!