content fields and tabs visibility
# help-with-umbraco
y
How to control content fields and tabs visibility in Umbraco CMS? like make the editors not see the properities, only the content that he should work on ?
j
Umbraco doesn't have permissions that are that granular built in. There is a package to make certain fields only visisble to admins though: https://github.com/LottePitcher/umbraco-admin-only-property
y
@Jemayn Thank you, it is perfect , thanks
r
https://docs.umbraco.com/umbraco-cms/reference/notifications/editormodel-notifications. I have implemented SendingContentNotification in my application to hide properties/ tabs for specific users example code: try { if (notification.Content.ContentTypeAlias.Equals(Product.ModelTypeAlias)) { var currentUserEmail = _boSercuirty.CurrentUser?.Email; //List hidePropertyAlias = new List() //{ // "propAlias1", // "propAlias2", //}; if (currentUserEmail != null && !currentUserEmail.ToLower().Contains("@test.test")) { foreach (var variant in notification.Content.Variants) { //variant.Tabs.ToList().ForEach(tab => //{ // tab.Properties = tab.Properties?.Where(i => !hidePropertyAlias.Contains(i.Alias.ToLower())); //}); variant.Tabs = variant.Tabs.Where(i => !i.Alias.ToLower().Contains("tabname")); } } } }
y
Hi @Ramya Devendiran , it will work like this, but I have alote of users, and sometimes I will romeove some users and add more, so I can not use this way
a
You can also do this with usergroups
y
How? The properties can not have user access, only access for all, using the adminOnlyProperity package it work, but as customize İ did not have a solution without using codes, İt will be useful to know that also, could you provide me the solution pls, it will be good knowledge to know everything and all the solution for this 🙏🏻
a
@Yasein H. Burqan I think the same as you did, but get the usergroup of the current member, and put those in an allow/disallow list ?
Easier managable
Something like
if (listWithAllowedUserGroups.Contains(currentUser.Usergroups)
11 Views