Printing out System Security Property Values in the Cache Terminal

Hello,

I am struggling to print out the actual property values of the Security.System class.

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

 

I was hoping to be able to print the Authentication Enabled properties of a system from the command line using the Get or GetProperties class method. Currently, however, I am only able to get a return 1 or Invalid Oref error.

 

I would expect one of these to work, but I think I am missing something. Any tips?

%SYS>w ##class(Security.System).Get("AutheEnabled")

1

%SYS>w ##class(Security.System).GetProperties("AutheEnabled")

0 {?2<INVALID OREF>zGetProperties+3^Security.System.1<%SYS3)$^zGetProperties+3^Security.System.1 +X^@ +1

 

I can do an Export from this same class and see the value in the XML file, but I would like to return that specific value from one line of code if possible.

 

Thanks,

- James

 

  • 0
  • 0
  • 97
  • 4
  • 1

Answers

Security.System is a persistent class with 1 object in it. The ID of the object is "SYSTEM". So this works

set ss = ##class(Security.System).%OpenId("SYSTEM")
write ss.AutheEnabled

The approach above is best if you want to access several properties. But if all you really want is one or two properties of Security.System, you can do this:

write ##class(Security.System).AutheEnabledGetStored("SYSTEM")

Thanks Joel. This is exactly what I was looking for. The explanation is helpful as well.

- James

Hey Joel,

One more question in relation to this.

I found the documentation page on the auto-generated method for PropertyGetStored, but how do I know if a class has this auto-generated function available?

For instance, I can use this function for Security.Users:

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

1

But this method does not exist for SYS.Database:

%SYS> w ##class(SYS.Database).MaxSizeGetStored("USER")

<METHOD DOES NOT EXIST> .....

Are the auto-gen functions only available to certain classes?

Thanks Again,

James

Classes extending %Persistent with default Storage have GetStored method for persistent properties.

SYS.Database in your case has custom storage, that's why this method does not exist.

Thanks! This was the information that I was looking for.

James