Programmatically setting access rights for assets folder for individual users

Vote:
 

This Post - http://world.episerver.com/forum/developer-forum/-EPiServer-75-CMS/Thread-Container/2014/2/Programmatically-setting-access-rights-for-assets-folder/ working for groups, not for individual user, any idea why its not working for users?

any other approach to achive this?

#147983
Apr 29, 2016 9:46
Vote:
 

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.ToLocal();
     startPageSecurity.AddEntry(new AccessControlEntry("daniel.ovaska", AccessLevel.Read, SecurityEntityType.User));
     _securityRepository.Save(startPageSecurity.ContentLink, startPageSecurity, SecuritySaveType.Replace);
}
#147984
Edited, Apr 29, 2016 10:32
Vote:
 

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

#147992
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.