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

 

Replies

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.

I have a related problem:

I can not see all the users through the Management Portal UI, but I can list all of them with SQL. Any ideas why?

Another question: What exactly is the "published API"? Where to find it?

Also, the warning in the docs only discourages the use through SQL. Object access and API  and Portal are fine, right.

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

Appreciate the clarification.

  • James