import org.argeo.api.acr.ContentSession;
import org.argeo.api.acr.DName;
import org.argeo.api.cms.CmsAuth;
+import org.argeo.api.cms.CmsSession;
import org.argeo.api.cms.directory.CmsDirectory;
import org.argeo.api.cms.directory.CmsUserManager;
import org.argeo.api.cms.directory.HierarchyUnit;
public static final char SLASH = '/';
public static final String SLASH_STRING = Character.toString(SLASH);
- public static final String ROOT_SLASH = "" + SLASH;
public static final String EMPTY = "";
/**
public static List<String> toPathSegments(String path) {
List<String> res = new ArrayList<>();
- if (EMPTY.equals(path) || ROOT_SLASH.equals(path))
+ if (EMPTY.equals(path) || Content.ROOT_PATH.equals(path))
return res;
collectPathSegments(path, res);
return res;
}
}
- public static ContentSession openDataAdminSession(ContentRepository repository) {
+ public static ContentSession openDataAdminSession(ContentRepository contentRepository) {
LoginContext loginContext;
try {
loginContext = CmsAuth.DATA_ADMIN.newLoginContext();
ClassLoader currentCl = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(ContentUtils.class.getClassLoader());
- return CurrentSubject.callAs(loginContext.getSubject(), () -> repository.get());
+ return CurrentSubject.callAs(loginContext.getSubject(), () -> contentRepository.get());
} finally {
Thread.currentThread().setContextClassLoader(currentCl);
}
}
+ public static ContentSession openSession(ContentRepository contentRepository, CmsSession cmsSession) {
+ return CurrentSubject.callAs(cmsSession.getSubject(), () -> contentRepository.get());
+ }
+
/**
* Constructs a relative path between a base path and a given path.
*