Book a Demo

Author Topic: Set "Require User Lock to Edit" to false via API  (Read 4083 times)

Maria P.

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Set "Require User Lock to Edit" to false via API
« on: September 07, 2015, 11:52:29 pm »
Hi all,

does anyone know if the property "Require User Lock to Edit" can be set to false via the API? Or if a DBMS-project with "Require User Lock to Edit"=true can be transferred to a local .eap project with "Require User Lock to Edit"=false?  

Background: We develop a transformation that basically copies an EA project (from a DBMS or a local EA project to a local EA project) and then deletes selected elements from the copy. Some of our customers work on DBMS projects that have security and "Require User Lock to Edit" enabled. While they need user locking for making changes on the DBMS project, they do not want to have the "Require User Locks to Edit" property in the local copy of the project. However, this is currently the case: The setting and all current user locks are copied from the DBMS project to the local eap file.
Furthermore, we have the problem that deleting a package in the copied document is not possible via the API if the package was already locked by another user (Exception is thrown:
System.Runtime.InteropServices.COMException: Exception from HRESULT: 0xE06D7363
   at EA.IDualCollection.Delete(Int16 index) ...).

Thank you,
Maria

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Set "Require User Lock to Edit" to false via A
« Reply #1 on: September 08, 2015, 12:39:32 am »
There is (AFAIK) no API function. However, you can manipulate t_secpolicies with
Code: [Select]
INSERT INTO t_secpolicies (Value, Property) VALUES (1, 'RequireLock')

and

DELETE FROM t_secpolicies WHERE Property='RequireLock'
You need Repository.Execute to perform the above SQLs. Most likely (?) you need to restart EA/re-open the repository to take effect after the change. You will need to try out.

q.

Maria P.

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Set "Require User Lock to Edit" to false via A
« Reply #2 on: September 09, 2015, 12:22:07 am »
Thanks querty,

I tested your suggestion. The following works for me:

Code: [Select]
Repository.Execute("DELETE FROM t_secpolicies WHERE Property='RequireLock' ");
Repository.Execute("DELETE FROM t_seclocks");

I'm not sure whether we can use that in our product, since Execute() is not officially supported, but at least it's a start.

Best regards,
Maria