How to set all CLS to read-only by default

Just like the title, I want to do code version control. I don't want to change CLS at will, but I don't want to use MakeClassDeployed, I just want to set the cls or mac to read-only and uneditable state。Does CLASS have such property?

  • 00
  • 0
  • 76
  • 4

Replies

If the user does not have W access on routines db he will not be able to edit it.

Also the  whole DB might be marked as RO.

thanks Eduard。  It is not necessary to mark whold DB as RO, only want to mark partial CLS as RO。 I found this feature,so is there any options about CLS for mark it as RO。

@sjbttt sjbttt  - it sounds like you want to set up source control which controls this Readonly property on the server, is that correct?  If that is the case, then you will need to use server-side source control hooks.  https://cedocs.intersystems.com/latest/csp/docbook/Doc.View.cls?KEY=GSTD_Hooks  would be a good place to start understanding how to manage this in general.

For your specific question, the way we force classes to be read-only with our source control hooks is via the GetStatus() method which should be extended from the %Studio.SourceControl.Base subclass of your hooks (see https://cedocs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?APP=1&CLASSNAME=%25Studio.SourceControl.Base
).  This method returns an "Editable" property which your hooks control and which can be used to force the IDE (Studio, Atelier or VSCode) to treat the file as Readonly, thereby preventing users from changing it.  In our development workflow, we will force the class to be Readonly in the following situations:

  •  The user does not have it checked out
  • A different user has it checked out
  • The entire namespace has source locked (e.g. for non-development environments)
  •  It is mapped from another namespace (we manage our source branches based on Namespace so we treat a read-only those things which are not in the current Namespace

Hope this is helpful.