· Aug 31, 2020

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?

Discussion (4)2
Log in or sign up to continue

@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.  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
).  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.