Author Topic: Preventing editing and deletion of connector tagged values in a locked package  (Read 161 times)

MrWappy

  • EA User
  • **
  • Posts: 144
  • Karma: +3/-0
    • View Profile
Hi

I've an interesting issue relating to connectors in locked packages.  Let me explain by example:

I have one user who creates a couple of components (A and B) and links them with a connector (C).  Both components and connectors have tags.
The package is fully locked.

Any user without rights to the locked area can create a diagram in their own area, add links of the components A & B to a diagram.  The conenctor(C) between them automatically appears.  All fine.

Next I try to modify the element and its tagged values - no can do, of course not there locked so behaviour as expected.  Fine.

Next I try to modify the tagged values on the connector - no problem, what I can edit tagged values and what's worse I can delete the tagged values!

However, on the positive side I cannot add any more relationships between components A & B since they are locked - EA picked that up.

So why the automation board for this issue, well and not to be outdone:

1. To prevent the deletion of the connector tagged values I use the EA_OnPreDeleteConnector event and using that can prevent the deletion based on checks made on ownership / groups obtained from the security tables.

2. To prevent the editing of tagged values, if ensure that I manage all tagged values in my addin using Predefined Structured Types of type AddinBroadcast I can intercept attempts to change the values and prevent an unauthorised user changing the value.  Although it places big restrictions are requires all tagged values to be known to the Addin - not ideal!

3. Then to prevent deletion of the connector tagged value... there isn't an event; all I really want is an event OnPreDeleteConnectorTaggedValue - Have I missed it?

One approach could be to use EA_OnContextItemChanged event to check when a connector is selected and whether it is between locked items and so will need protecting. If that is the case then I make a copy of all the tagged values, and if there is a change then use the EA_OnNotifyContextItemModified event to reinstate them.  Not an approach I like and not that confident that something could be missed, so just doesn't seem correct.

Anybody else had this issue and if so what approach worked/didn't work?

Thanks

Adrian







 

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7745
  • Karma: +165/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Hi Adrian,

First and foremost I would report a bug to Sparx.
After all you are trying to fix an obvious bug for them using your add-in.

Then I think only the context item event approach will work.
The upside of it is that you can control everything with that. Editing, deleting, creating

Geert

MrWappy

  • EA User
  • **
  • Posts: 144
  • Karma: +3/-0
    • View Profile
Solved thanks to Simon reminding me of an option I hadn't noticed!

"connectors will only be locked if the "Configure | Security > Manage > Apply Locks to Connectors" option is enabled."

So far tests seems to work; and saves me time writing code.

Just reminds me there are so many things in EA!