Question
· Jun 27

Identifying System-Defined vs User-Defined Web Applications in IRIS

Hello Community,

Is there a programmatic method or specific property to differentiate system-defined (/csp/altelier , /api/mgmnt and so on)  or user-defined web applications in IRIS?

Thanks!

Product version: IRIS 2024.1
$ZV: IRIS for Windows (x86-64) 2024.1.1 (Build 347U) Thu Jul 18 2024 17:40:10 EDT
Discussion (5)3
Log in or sign up to continue

To differentiate system-defined and user-defined web applications in InterSystems IRIS, one can use the Management Portal or programmatically determine the type of application.

Using the Management Portal:

  1. Navigate to System Administration > Security > Applications > Web Applications.
  2. In the list that appears, each application's type will be identified in the Type column, with descriptors such as:
    • User application (CSP)
    • System application (CSP,System) [1][2].

Programmatically:

You can use the %System.CSP.GetDefaultApp method to return the default or other associated properties of applications for a specific namespace. Additionally, you might use specific commands to identify built-in applications as most system-defined apps have predefined names like /api/mgmnt, /csp/atelier, and so on [1][2].

Example Code to Create a Web Application in the %SYS Namespace:

zn "%SYS"
set props("Path") = "/opt/my/app/csp"
set props("Description") = "My Cool Application"
do ##class(Security.Applications).Create("/csp/test", .props)

The above code dynamically creates a web application definition and can be enhanced to include checks for identifying system vs. user-defined properties [3].

These methods should help differentiate the types of web applications efficiently based on your specific requirements.

Sources:

In the %SYS namespace, you can query the table Security.Applications and check the type column. If you do this in the system management portal in display mode, the Type column will start with "System". In logical mode, though, it will be a number. 1 is System, 2 is CSP Application, 4 is a privileged routine application, and 8 is a client application, and if an application is more than one of those things, the Type column is their sum. For example, if it's a System applcation AND a CSP application, the type will be 3. That complicated things, but fortunately since the 1 is the only odd number and it signified system applications, we can use the modulus function to identify system applications as follows.

select * from security.applications where {fn MOD(type,2)} = 1

Also, at the risk of self-promotion, I wrote an article detailing more about managing applications programatically a while back. You can find it here.

Hello @David Hockenbroch 
The "type" column is partially useful in identifying some system-generated web applications. However, certain CSP applications such as /api/atelier, /api/docdb, /api/healthshare-rest/hssys, /api/iam, and /api/iknow are also system-generated by default in IRIS. I want to differentiate these system-generated applications from user-defined (/aktest1) web applications.

Sounds like it's more accurate to say you want to exclude web applications that ship with IRIS, not only those that are of type "System." 

Using the security.applications table @David Hockenbroch mentioned, I'd exclude those from  namespaces InterSystems uses for product, e.g.:

SELECT name,namespace,resource,type FROM security.applications 
WHERE NameSpace not in ('%SYS','HSSYS','HSLIB','HSCUSTOM')