X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms.e4%2Fsrc%2Forg%2Fargeo%2Fcms%2Fe4%2Fparts%2FEgoDashboard.java;fp=org.argeo.cms.e4%2Fsrc%2Forg%2Fargeo%2Fcms%2Fe4%2Fparts%2FEgoDashboard.java;h=0000000000000000000000000000000000000000;hb=8282011b0e20e80704b209ad55fa9fb132e16280;hp=5a805d1e953646da314646793cb16bd87b3b58d2;hpb=633a8acd189cc22f06944d278879601189be1bc8;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms.e4/src/org/argeo/cms/e4/parts/EgoDashboard.java b/org.argeo.cms.e4/src/org/argeo/cms/e4/parts/EgoDashboard.java deleted file mode 100644 index 5a805d1e9..000000000 --- a/org.argeo.cms.e4/src/org/argeo/cms/e4/parts/EgoDashboard.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.argeo.cms.e4.parts; - -import java.security.AccessController; -import java.time.ZonedDateTime; - -import javax.annotation.PostConstruct; -import javax.security.auth.Subject; - -import org.argeo.api.cms.CmsSession; -import org.argeo.cms.auth.CurrentUser; -import org.argeo.cms.osgi.CmsOsgiUtils; -import org.argeo.cms.swt.CmsSwtUtils; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; - -/** A canonical view of the logged in user. */ -public class EgoDashboard { - private BundleContext bc = FrameworkUtil.getBundle(EgoDashboard.class).getBundleContext(); - - @PostConstruct - public void createPartControl(Composite p) { - p.setLayout(new GridLayout()); - String username = CurrentUser.getUsername(); - - CmsSwtUtils.lbl(p, "" + CurrentUser.getDisplayName() + ""); - CmsSwtUtils.txt(p, username); - CmsSwtUtils.lbl(p, "Roles:"); - roles: for (String role : CurrentUser.roles()) { - if (username.equals(role)) - continue roles; - CmsSwtUtils.txt(p, role); - } - - Subject subject = Subject.getSubject(AccessController.getContext()); - if (subject != null) { - CmsSession cmsSession = CmsOsgiUtils.getCmsSession(bc, subject); - ZonedDateTime loggedIndSince = cmsSession.getCreationTime(); - CmsSwtUtils.lbl(p, "Session:"); - CmsSwtUtils.txt(p, cmsSession.getUuid().toString()); - CmsSwtUtils.lbl(p, "Logged in since:"); - CmsSwtUtils.txt(p, loggedIndSince.toString()); - } - } -}