Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "permission" to the setting property #43

Closed
wakuflair opened this issue Dec 11, 2020 · 6 comments
Closed

Add "permission" to the setting property #43

wakuflair opened this issue Dec 11, 2020 · 6 comments

Comments

@wakuflair
Copy link
Member

see #40 (comment)

@cihangll
Copy link
Contributor

cihangll commented Dec 19, 2020

Hi @wakuflair,
I think we don't need Permission field. We already know the group and setting name at runtime. We can implement this as default behaviour. If user define permission like SettingUiPermissions.Tenant.GroupName.SettingName we can automatically check this at runtime. If user dont define this permission we can pass and show specified setting on the UI.

For example, we have 2 different groups and 4 different setting for each group. We can write like this. (spaghetti code)

var moduleGroup = context.AddGroup(SettingUiPermissions.GroupName, L("Permission:SettingUi"));
var root = moduleGroup.AddPermission(SettingUiPermissions.Tenant, L("Permission:SettingUi.Tenant"));

var group1 = root.AddChild(SettingUiPermissions.Tenant + ".Group1", L("Permission:SettingUi.Tenant.Group1"));
group1.AddChild(SettingUiPermissions.Tenant + ".Group1" + ".Setting1"); // If the user has this permission, show the specified setting
//group1.AddChild(SettingUiPermissions.Tenant + ".Group1" + ".Setting2"); always show
//group1.AddChild(SettingUiPermissions.Tenant + ".Group1" + ".Setting3"); always show
group1.AddChild(SettingUiPermissions.Tenant + ".Group1" + ".Setting4"); // If the user has this permission, show the specified setting

var group2 = root.AddChild(SettingUiPermissions.Tenant + ".Group2", L("Permission:SettingUi.Tenant.Group2"));
//group2.AddChild(SettingUiPermissions.Tenant + ".Group2" + ".Setting1"); always show
//group2.AddChild(SettingUiPermissions.Tenant + ".Group2" + ".Setting2"); always show
//group2.AddChild(SettingUiPermissions.Tenant + ".Group2" + ".Setting3"); always show
group2.AddChild(SettingUiPermissions.Tenant + ".Group2" + ".Setting4");// If the user has this permission, show the specified setting

image

@wakuflair
Copy link
Member Author

Sounds a good idea!

I will take a closer look, thank you @cihangll 😄

@cihangll
Copy link
Contributor

I can PR for this. :)

@cihangll
Copy link
Contributor

Hi @wakuflair ,
Can you check this PR for this?

@wakuflair
Copy link
Member Author

Sure, I will look at it ASAP.

@wakuflair
Copy link
Member Author

Resolved with #46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants