Published on InterSystems Developer Community (https://community.intersystems.com)

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

Question
James Hipp · Aug 7, 2019

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

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

#ObjectScript #System Administration #Terminal #Caché

Source URL:https://community.intersystems.com/post/array-property-setters-and-using-classsecurityusersmodify-disable-user-account-terminal