- ABP Framework version: v2.9
- UI type: Angular
- Tiered (MVC) or Identity Server Seperated (Angular): no
Relating to Settings and Features.
- One of our most used API calls needs to receive up to 30 settings to create data for a View Model. We are concerned about the time this will take on each call. Is the settings System suitable for this style of usage? Will it be efficient?
- Thoughout our app we need to check both if a Feature is enabled and a Setting indicating is a particular user can use that feature (e.g. Invoice Feature is enabled for a tenant, but only some users have access). What would be the most efficient way to implement this?
11 Answer(s)
-
0
Hi,
- Setting system to read the value from cache,You don't have to worry about performance. Or you can use the object as the setting value, like this:
public class qaSettingDefinitionProvider : SettingDefinitionProvider { public override void Define(ISettingDefinitionContext context) { context.Add(new SettingDefinition(MySettingModel.SettingKey, JsonConvert.SerializeObject(new MySettingModel {Name = "name", Email = "email"}))); } } public class MySettingModel { public const string SettingKey = "MySettingModel"; public string Name { get; set; } public string Email { get; set; } }
Then you can read all the required settings at once:
- You can add features for tenants, like (Invoice...) and check feature in invoice management. you can grant users invoice management permission. Feature management document is not yet complete, you can refer to https://github.com/abpframework/abp/issues/2163.
I saw that you posted a duplicate question: https://support.abp.io/QA/Questions/262/Efficient-user-of-Settings-and-Features
-
0
Thanks.
I can see the settings page in as admin. But I can't find where to make tenant settings available for the tenant.
Also how does a tenant see only their users and change settings for those user?
And how can users change setting their are allowed to change.
Or do need to write all that.
-
0
Hi,
Tenants should be able to see the settings page, you can check current user is granted settings management permissions. Like this :
A setting value read from the following provider:
- DefaultValueSettingValueProvider
- ConfigurationSettingValueProvider
- GlobalSettingValueProvider
- TenantSettingValueProvider
- UserSettingValueProvider
Setting fallback system works from bottom (user) to top (default).
You can set the value using the method of
ISettingManager
://For tenant's setting await _settingManager.SetForCurrentUserAsync("App.UI.LayoutType", "LeftMenu"); await _settingManager.SetForUserAsync(user1Id, "App.UI.LayoutType", "LeftMenu"); //For user's setting await _settingManager.SetForCurrentTenantAsync("App.UI.LayoutType", "LeftMenu"); await _settingManager.SetForTenantAsync(tenant1Id, "App.UI.LayoutType", "LeftMenu");
Have a nice day : ).
-
0
Thanks. So I am still having following issues to get setting working. Can you help.
- Can I call the setting page for a User as well as a tenant
- how can I specify a setting as admin only
- how do I add a select in the interface.
-
0
as I understand from your questions, you are trying to achieve a permission problem with settings. why don't you try to use Roles for this. add a permission to your admin role. or create a new TenantRole and add permissions to TenantRole. Setting system is more application related values (there's no scope for admins or users).
See the definition https://docs.abp.io/en/abp/latest/Settings#settingdefinition. There's no option for users
-
0
Thanks Apler,
I have looked at the permissions system and the multi-tenant modules are I have the following issues. These are things we use to manage tenants in our current system that we need to explore in abp.io before full implementation. Which of there can we acheive these?
- Can we log in as a "host" user to a tenant. If we do this by creating a new user called, say, HostAdmin can that be hidden from the tenant in the user list. We need this so we can log into a tenant and check their data live or do admin tasks for them.
- There are permissions that we want the HostAdmin to set for tenants without letting them see or know about them. Also we don't want to show permissions if they don't have access to the feature.
- We only want to show localisation and settings associated with allowed permissions and features.
- A way to "loop" through all tenants and update permissions, localosations or settings globally access all tenants..
For 1, 2 and 3 I think I would need override services to introduce a filter to the result, But I am having trouble getting this to work. Perhaps you can provide an example.
Finally we wnt to persist permissions in a database. The doumentation ways to look at permission management module documentation, but it is TBD. when will this be available.
-
0
Hi:
- You can create
host
user , but if you want hidden from the tenant in the user list, you need use object extend system add an identifier (like:IsHostUser
) toIdentityUser
entity and overrideIdentityUserAppService
to filterIsHostUser
. - Add an identifier(like:
IsHostPermisson
) to theProperties
property ofPermissionDefinition
. - It takes a lot of work, you need to associate localization, settings with permissions and features, and then filter when displaying.
- You can log in to the application as the host or use
ICurrentTenant.Change(null)
to switch to the host , and then you can get all tenants.
If I have an incorrect understanding, please let me know. I will try to create an simple example for 1,2,3.
Have a nice day : ).
- You can create
-
0
HI,
Yes you ubderstand correctly. The examples of thes 4 points would be greatly appreciated so we can get past the setup phase and start implementing our solution.. Are the examples overrides of the commercial modules or are you suggesting writing our own UIs.
Ian :)
-
0
Hi,
Example : https://github.com/realLiangshiwei/AbpQa263Demo
hostUser
will not be displayed in the user listhostPermission
will not be displayed in the permisson group- Can't see settings without permissions (language management module is a commercial module, but you can do it according to the first point)
- In
DemoAppService
, users of all tenants can be update.
Note: This is not a best practice and not complete, it just provides an idea
-
0
-
0
Instance failure
Please check your database server.