Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

How can I delete user level settings? #2525


User avatar
0
eggersa created

My application provides application level smtp settings for sending emails. However, the user is able to override those settings by applying his own user level settings. At some point the user might like to not use his own settings anymore but fallback to the application setting values. To do that, I would like to delete those user level values for a given user.

How can I delete a user level setting using abp 0.9.3, such that I get the application level setting upon executing GetSettingValue(...) aftwards?


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can get application level setting values and update user settings with those values. It should automatically delete user level settings since it has the same value with the application.

    Or you can delete those records directly from DB using a repository.

    By the way, do you allow tenant's to change settings as well ? If so, this changes the case a little bit.

  • User Avatar
    0
    eggersa created

    Hello

    Thank you imscagdas for your answer. Actually, just deleting the database entry is not enough. You have also to clear the cache with wich I had some issues. Later on I found out how to get and clear the cache. It would be nice to have some Invalidate() function on the cache to make life easier in those situations.

    Setting the setting value to the default value in order to delete the setting value from database and cache seems somewhat intransparent and implementation specific. The ISettingManager interface does not specify such behaviour.