OneIdentity / IdentityManager.Imx

HTML5 source code for Identity Manager web apps
Other
26 stars 107 forks source link

Configuring a filter clause on API method has no effect: configuration key of type 'API method configuration' #113

Closed NielsDeGroot closed 4 months ago

NielsDeGroot commented 4 months ago

Configuring a filter clause on API method has no effect.

In the Administration Portal create a configuration key of type 'API method configuration' for example 'shop_serviceitems' with whereclause: Ident_AccProduct <> 'FilterThisServiceItem'

Administration Portal > Configuration: Web Portal (click on: three dots icon) Create configuration key Select where to add the configuration key: API method configuration Enter the API method name, replacing slashes with underscores, for example "itshop_cart". Name of the new configuration key: shop_serviceitems [Create]

Property configuration API method configuration / shop_serviceitems / Filter condition Specify a filter condition (WHERE clause). To refer to the identifier of the current user, use the %useruid% variable. Value: Ident_AccProduct <> 'FilterThisServiceItem' PropertyConfig/MethodConfiguration/shop_serviceitems/WhereClause [Apply] (*) Apply globally [Apply]

After applying this new configuration key you can still see it in the Administration Portal when you search for it: shop_serviceitems (it's included in the end-point: https://itshop.groot.net/apiserverdev/admin/apiconfig/portal)

Now log out of the Administration Portal and/or perform an IIS reset the newly added config key is no longer visible in the Administration Portal (not included in the the end-point: https://itshop.groot.net/apiserverdev/admin/apiconfig/portal)

The new config key is present in the 'CCC.CompositionApi.global.json' _{"Scopes":[{"AppliesTo":"portal","Ignore":false,"Data":{"PropertyConfig/MethodConfiguration/shop_serviceitems/WhereClause":"IdentAccProduct <> 'FilterThisServiceItem'"}}],"AppliesTo":null,"Ignore":false,"Data":null}

In the logging you can see that 1 setting is read from the config json, but you cannot see find anything in the logging about the 'MethodConfiguration/shop_serviceitems' getting applied/added. 2024-02-12 10:12:10.1673 DEBUG (WebLog ) : Config: read 1 settings from "C:\inetpub\wwwroot\ApiServerDev\bin\CCC.CompositionApi.global.json"

So it looks like the 'API method configuration' is not getting picked-up after configuring. That's why it's not visible in the Administration Portal after configuring and has no effect on the API method.

Opposed to if you create a create a configuration key of type 'Filters for object selection by table' PropertyConfig/FkWhereClausesByTable/Person value: IsTemporaryDeactivated = 0

This type does get picked-up you can see this in the logging. Add it's visible in the Administration Portal after configuring. And it has effect on the response list: /portal/admin/person/UID_PersonHead/candidates

C:\inetpub\wwwroot\ApiServerDev\bin\CCC.CompositionApi.global.json _{"Scopes":[{"AppliesTo":"portal","Ignore":false,"Data":{"PropertyConfig/MethodConfiguration/shop_serviceitems/WhereClause":"IdentAccProduct <> 'FilterThisServiceItem'","PropertyConfig/FkWhereClausesByTable/Person":"IsTemporaryDeactivated = 0"}}],"AppliesTo":null,"Ignore":false,"Data":null}

2024-02-12 10:18:30.9175 DEBUG (WebLog ) : Config: read 2 settings from "C:\inetpub\wwwroot\ApiServerDev\bin\CCC.CompositionApi.global.json" 2024-02-12 10:18:42.0172 INFO (WebLog ) : Added custom configuration: PropertyConfig/FkWhereClausesByTable/Person 2024-02-12 10:18:42.0172 DEBUG (WebLog ) : ConfigService: Applied Global customized value for PropertyConfig/FkWhereClausesByTable/Person

Regards, Niels

Mathnstein commented 4 months ago

Hi @NielsDeGroot - I was able to repro this but strangely enough, only once and it didn't happen again. I'll pass this through as an internal ticket to see what is going on.

Mathnstein commented 4 months ago

Created an internal ticket: 446293

juancarloscamargo commented 4 months ago

I've been able to reproduce it in v92.

  1. Created a custom config key under API Method configuration for the portal app, tried a few methods.
  2. The custom key appears in the configuration section of the portal app.
  3. Restarted the apiserver web server, the key disappears from the web config section although it is kept in CCC,CompositionApi.global.json file.
  4. Same thing applied to filter config keys behaves as @NielsDeGroot states: Kept both in the config section and the file.
  5. Even they seem to be loaded, they keys have no effect on the app's behaviour.

More: If you manually delete the entries in the CCC...json file and restart the server, all the custom config keys that you've created get redownloaded into the file and I can see these keys, yet those for the api method are not present in the web config section. I think this local file handling needs a good review. Web server is IIS running on Windows server 2019.

hannoquest commented 4 months ago

@juancarloscamargo Please contact support for a fix regarding the mentioned ticket ID 446293. This is a bug on the server side and cannot be fixed in this repo.