Try our conversational search powered by Generative AI!

Programmatically setting access rights for assets folder for individual users


This Post - working for groups, not for individual user, any idea why its not working for users?

any other approach to achive this?

Apr 29, 2016 9:46

Are you really really sure you want to do that? Setting access rights on user level quickly becomes an administrative nightmare. :)

If you do want to do it anyway...

var _securityRepository = ServiceLocator.Current.GetInstance<IContentSecurityRepository>();
var startPageSecurity = _securityRepository.Get(ContentReference.StartPage).CreateWritableClone() as IContentSecurityDescriptor;
if (startPageSecurity != null)
     if (startPageSecurity.IsInherited) 
     startPageSecurity.AddEntry(new AccessControlEntry("daniel.ovaska", AccessLevel.Read, SecurityEntityType.User));
     _securityRepository.Save(startPageSecurity.ContentLink, startPageSecurity, SecuritySaveType.Replace);
Edited, Apr 29, 2016 10:32

Yes  Daniel Ovaska, I am creating custom access right settings page for admin users.  thanks its working fine.

Apr 29, 2016 11:03
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.