AnsweredAssumed Answered

disable permission inheritance

Question asked by nick.l on Feb 20, 2013
Latest reply on Feb 21, 2013 by nick.l
There are some topic about this issue. Currently, I am using Alfresco 4.2 community version.

So far I didn't find any API which can disable the permission inheritance. Typically, the root folder has the (GROUP_EVERYONE, consumer) permission, which I don't want its sub-folders to inherit. I can manually disable it from admin console, but failed to find any java API to do so.

I tried to removed the (GROUP_EVERYONE, consumer) permission from root folder in admin console. Then trying to login as a non-admin user using following code, but it gives me "org.alfresco.repo.security.permissions.AccessDeniedException - 01209024 Access Denied.  You do not have the appropriate permissions to perform this operation."

Any suggestions?

—-code—-
SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
Map<String, String> parameter = new HashMap<String, String>();

parameter.put(SessionParameter.USER, userName);
parameter.put(SessionParameter.PASSWORD, password);
parameter.put(SessionParameter.AUTH_HTTP_BASIC, "true" );

parameter.put(SessionParameter.ATOMPUB_URL, "http://localhost:8080/alfresco/service/api/cmis");
parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");

List<Repository> repositories = new ArrayList<Repository>();
repositories = sessionFactory.getRepositories(parameter);

// create session with the first (and only) repository
Repository repository = repositories.get(0);
parameter.put(SessionParameter.REPOSITORY_ID, repository.getId());

Session session = sessionFactory.createSession(parameter);

—–code end——

Outcomes