Sentry preference in Online

I try to use sentry preference to control access to persons in an Online installation. For instance, to make one person invisible for all users, I insert a record into the userpreference table like this:

  se.addData("UserPreference.deflevel", "2");
  se.addData("UserPreference.maxlevel", "5");
  se.addData("UserPreference.owner_id", "0");
  se.addData("UserPreference.prefsection", "Rights-person-" + personId);
  se.addData("UserPreference.prefkey", "Table");
  se.addData("UserPreference.prefvalue", "0");
  se.insert();

However, the effect is shown only after recycle application pool.

The same hold true if I use NetServer classes to create a userpreference record (NSPereferenceAgent).

Is there any way to circumvent recycling the application pool?

RE: Sentry preference in Online

You could try a flush:

https://online.superoffice.com/custXXXX/default.aspx?flush

Av: Matthijs Wagemakers 18. jun 2018

RE: Sentry preference in Online

Hi Matthijs

flush does not help :-(

Marc

Av: Marc Eberhard 18. jun 2018

RE: Sentry preference in Online

Hi Marc,

Preferences are cached per user, and not affected by a flush. Using the SearchEngine will not have any influence on a sites cache.

Using the NSPreferenceAgent code does update the caches, but only for the current principal/user.

Best regards.

Av: Tony Yates 19. jun 2018

RE: Sentry preference in Online

Hi Tony,

is there any way to update the cache for other uses too, i.e. other than the current user?

That is what we need for the script to behave correctly.

Best regards

Marc

Av: Marc Eberhard 19. jun 2018

RE: Sentry preference in Online

What about the CRMScript method "flushCaches()" ?

Av: Frode Lillerud 19. jun 2018

RE: Sentry preference in Online

HI Marc,

I would have mentioned it, but I'm afraid there isn't. All principal preference caches should timeout/refresh after 10 minutes.

No Frode, this just called DiagnosticsAgent.FlushCaches. Doesn't touch preferences.

Best regards.

Av: Tony Yates 19. jun 2018

RE: Sentry preference in Online

Frode: good idea, but "flushCaches()" does not help, sorry.

Tony: thanks for the hints. And yes, if you wait 10 minutes then SuperOffice displays data correctly, according to the preference sentry set before.

Av: Marc Eberhard 19. jun 2018