X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms%2Fsrc%2Forg%2Fargeo%2Fcms%2Facr%2FCmsContentRepository.java;h=46222ce1ac0d2248b58f67ed8bdb3e13b8a6e68a;hb=da9d144b6b241e1526a3bd255dff905a7969a5bc;hp=c2d6b21e406f61a5930e43f235de6fa8e7c2e42b;hpb=fdf44255df56ae179b904e4ab326bf595674800e;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms/src/org/argeo/cms/acr/CmsContentRepository.java b/org.argeo.cms/src/org/argeo/cms/acr/CmsContentRepository.java index c2d6b21e4..46222ce1a 100644 --- a/org.argeo.cms/src/org/argeo/cms/acr/CmsContentRepository.java +++ b/org.argeo.cms/src/org/argeo/cms/acr/CmsContentRepository.java @@ -12,6 +12,8 @@ import org.argeo.api.acr.ContentSession; import org.argeo.api.acr.spi.ProvidedRepository; import org.argeo.api.cms.CmsAuth; import org.argeo.api.cms.CmsSession; +import org.argeo.api.cms.CmsState; +import org.argeo.api.uuid.UuidFactory; import org.argeo.cms.auth.CurrentUser; import org.argeo.cms.internal.runtime.CmsContextImpl; @@ -19,9 +21,13 @@ import org.argeo.cms.internal.runtime.CmsContextImpl; * Multi-session {@link ProvidedRepository}, integrated with a CMS. */ public class CmsContentRepository extends AbstractContentRepository { + public final static String RUN_BASE = "/run"; private Map userSessions = Collections.synchronizedMap(new HashMap<>()); + private CmsState cmsState; + private UuidFactory uuidFactory; + /* * REPOSITORY */ @@ -37,7 +43,8 @@ public class CmsContentRepository extends AbstractContentRepository { CmsSession cmsSession = CurrentUser.getCmsSession(); CmsContentSession contentSession = userSessions.get(cmsSession); if (contentSession == null) { - final CmsContentSession newContentSession = new CmsContentSession(this, cmsSession.getSubject(), locale); + final CmsContentSession newContentSession = new CmsContentSession(this, cmsSession.getUuid(), + cmsSession.getSubject(), locale); cmsSession.addOnCloseCallback((c) -> { newContentSession.close(); userSessions.remove(cmsSession); @@ -57,7 +64,20 @@ public class CmsContentRepository extends AbstractContentRepository { throw new RuntimeException("Could not login as data admin", e1); } finally { } - return new CmsContentSession(this, loginContext.getSubject(), Locale.getDefault()); + return new CmsContentSession(this, getCmsState().getUuid(), loginContext.getSubject(), + Locale.getDefault()); + } + + protected CmsState getCmsState() { + return cmsState; + } + + public void setCmsState(CmsState cmsState) { + this.cmsState = cmsState; + } + + public void setUuidFactory(UuidFactory uuidFactory) { + this.uuidFactory = uuidFactory; } }