Array, Property Setters, and Using ##class(Security.Users).Modify... to Disable a User Account from the Terminal

Primary tabs

Hello,

I am wondering the best way to disable a user account using this class in Cache (Security.Users).

https://cedocs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls

 

Example User Account = jhipp

Currently is Enabled

 

I know that we can use the auto-generated EnabledGetStored method, for example:

%SYS> w ##class(Security.Users).EnabledGetStored("jhipp")
1

 

There is not an auto-generated method to set this property, right?

 

I can modify this property with the Modify function, but I have to build a temp array with one value etc...

%SYS> s temp("Enabled")=0

%SYS> zw temp

temp("Enabled")=0

%SYS> w ##class(Security.Users).Modify("jhipp",  .temp)

 

Is there an easier way to do this, such as an auto-generated setter function or a shortcut for the array similar to this?

 

%SYS> w ##class(Security.Users).Modify("jhipp", "Enabled" = 0)

 

 

Just wanted to verify that there was not an easier way.

 

Thanks,

James

 

  • 0
  • 0
  • 75
  • 1
  • 1

Answers

the class documentation has a special warning:

The table for this class should be manipulated only through object access,
the published API's or through the System Management Portal.
It should not be updated through direct SQL access.

 

As Security is a sensitive subject I think any other approach could cause serious damage or at least a risk.

Thanks Robert. I missed that warning when I was reading through the docs. That makes sense.

Appreciate the clarification.

  • James