public void intercept(InfoGluePrincipal infoGluePrincipal, InterceptionPointVO interceptionPointVO, Map extradata, boolean allowCreatorAccess) throws ConstraintException, SystemException, Exception
{
logger.info("interceptionPointVO:" + interceptionPointVO.getName());
AccessConstraintExceptionBuffer ceb = new AccessConstraintExceptionBuffer();
if(interceptionPointVO.getName().equalsIgnoreCase("Content.Read"))
{
Integer contentId = (Integer)extradata.get("contentId");
ContentVO contentVO = ContentControllerProxy.getController().getContentVOWithId(contentId);
if(!allowCreatorAccess || !contentVO.getCreatorName().equalsIgnoreCase(infoGluePrincipal.getName()))
{
Integer protectedContentId = ContentControllerProxy.getController().getProtectedContentId(contentId);
if(protectedContentId != null && !AccessRightController.getController().getIsPrincipalAuthorized(infoGluePrincipal, "Content.Read", protectedContentId.toString()))
ceb.add(new AccessConstraintException("Content.contentId", "1000"));
}
}
else if(interceptionPointVO.getName().equalsIgnoreCase("Component.Select"))
{
Integer contentId = (Integer)extradata.get("contentId");
ContentVO contentVO = ContentControllerProxy.getController().getContentVOWithId(contentId);
if(!allowCreatorAccess || !contentVO.getCreatorName().equalsIgnoreCase(infoGluePrincipal.getName()))
{
Integer protectedContentId = contentId; //ContentControllerProxy.getController().getProtectedContentId(contentId);
if(protectedContentId != null && !AccessRightController.getController().getIsPrincipalAuthorized(infoGluePrincipal, "Component.Select", protectedContentId.toString()))
ceb.add(new AccessConstraintException("Content.contentId", "1000"));
}
}
else if(interceptionPointVO.getName().equalsIgnoreCase("Content.Write"))
{
Integer contentId = (Integer)extradata.get("contentId");
ContentVO contentVO = ContentControllerProxy.getController().getContentVOWithId(contentId);
if(!allowCreatorAccess || !contentVO.getCreatorName().equalsIgnoreCase(infoGluePrincipal.getName()))
{
Integer protectedContentId = ContentControllerProxy.getController().getProtectedContentId(contentId);
if(protectedContentId != null && !AccessRightController.getController().getIsPrincipalAuthorized(infoGluePrincipal, "Content.Write", protectedContentId.toString()))
ceb.add(new AccessConstraintException("Content.contentId", "1001"));
}
}
else if(interceptionPointVO.getName().equalsIgnoreCase("Content.Create"))
{
Integer contentId = (Integer)extradata.get("contentId");
ContentVO contentVO = ContentControllerProxy.getController().getContentVOWithId(contentId);
if(!allowCreatorAccess || !contentVO.getCreatorName().equalsIgnoreCase(infoGluePrincipal.getName()))
{
Integer protectedContentId = ContentControllerProxy.getController().getProtectedContentId(contentId);
if(protectedContentId != null && !AccessRightController.getController().getIsPrincipalAuthorized(infoGluePrincipal, "Content.Create", protectedContentId.toString()))
ceb.add(new AccessConstraintException("Content.contentId", "1002"));
}
}
else if(interceptionPointVO.getName().equalsIgnoreCase("Content.Delete"))
{
Integer contentId = (Integer)extradata.get("contentId");
ContentVO contentVO = ContentControllerProxy.getController().getContentVOWithId(contentId);
if(!allowCreatorAccess || !contentVO.getCreatorName().equalsIgnoreCase(infoGluePrincipal.getName()))
{
Integer protectedContentId = ContentControllerProxy.getController().getProtectedContentId(contentId);
if(protectedContentId != null && !AccessRightController.getController().getIsPrincipalAuthorized(infoGluePrincipal, "Content.Delete", protectedContentId.toString()))
ceb.add(new AccessConstraintException("Content.contentId", "1003"));
}
}
else if(interceptionPointVO.getName().equalsIgnoreCase("Content.Move"))
{
Integer contentId = (Integer)extradata.get("contentId");
ContentVO contentVO = ContentControllerProxy.getController().getContentVOWithId(contentId);
if(!allowCreatorAccess || !contentVO.getCreatorName().equalsIgnoreCase(infoGluePrincipal.getName()))
{
Integer protectedContentId = ContentControllerProxy.getController().getProtectedContentId(contentId);
if(protectedContentId != null && !AccessRightController.getController().getIsPrincipalAuthorized(infoGluePrincipal, "Content.Move", protectedContentId.toString()))
ceb.add(new AccessConstraintException("Content.contentId", "1004"));
}
}
else if(interceptionPointVO.getName().equalsIgnoreCase("Content.CreateVersion"))
{
Integer contentId = (Integer)extradata.get("contentId");
if(contentId != null)
{
ContentVO contentVO = ContentControllerProxy.getController().getContentVOWithId(contentId);
if(!allowCreatorAccess || !contentVO.getCreatorName().equalsIgnoreCase(infoGluePrincipal.getName()))
{
Integer protectedContentId = ContentControllerProxy.getController().getProtectedContentId(contentId);
if(ContentVersionControllerProxy.getController().getIsContentProtected(contentId, true) && !AccessRightController.getController().getIsPrincipalAuthorized(infoGluePrincipal, "Content.CreateVersion", protectedContentId.toString()))
ceb.add(new AccessConstraintException("Content.contentId", "1002"));
}
}
}
else if(interceptionPointVO.getName().equalsIgnoreCase("Content.SubmitToPublish"))
{
Integer contentId = (Integer)extradata.get("contentId");
ContentVO contentVO = ContentControllerProxy.getController().getContentVOWithId(contentId);
if(!allowCreatorAccess || !contentVO.getCreatorName().equalsIgnoreCase(infoGluePrincipal.getName()))
{
Integer protectedContentId = ContentControllerProxy.getController().getProtectedContentId(contentId);
if(protectedContentId != null && !AccessRightController.getController().getIsPrincipalAuthorized(infoGluePrincipal, "Content.SubmitToPublish", protectedContentId.toString()))
ceb.add(new AccessConstraintException("Content.contentId", "1005"));
}
}
else if(interceptionPointVO.getName().equalsIgnoreCase("Content.ChangeAccessRights"))
{
Integer contentId = (Integer)extradata.get("contentId");
ContentVO contentVO = ContentControllerProxy.getController().getContentVOWithId(contentId);
if(!allowCreatorAccess || !contentVO.getCreatorName().equalsIgnoreCase(infoGluePrincipal.getName()))
{
Integer protectedContentId = ContentControllerProxy.getController().getProtectedContentId(contentId);
if(protectedContentId != null && !AccessRightController.getController().getIsPrincipalAuthorized(infoGluePrincipal, "Content.ChangeAccessRights", protectedContentId.toString()))
ceb.add(new AccessConstraintException("Content.contentId", "1006"));
}
}
else if(interceptionPointVO.getName().equalsIgnoreCase("ContentVersion.Read"))
{
Integer contentVersionId = (Integer)extradata.get("contentVersionId");
ContentVersionVO contentVersionVO = ContentVersionControllerProxy.getController().getContentVersionVOWithId(contentVersionId);
if(!allowCreatorAccess || !contentVersionVO.getVersionModifier().equalsIgnoreCase(infoGluePrincipal.getName()))
{
if(ContentVersionControllerProxy.getController().getIsContentProtected(contentVersionVO.getContentId(), false) && !AccessRightController.getController().getIsPrincipalAuthorized(infoGluePrincipal, "ContentVersion.Read", contentVersionId.toString()))
{
ceb.add(new AccessConstraintException("ContentVersion.contentVersionId", "1000"));
}
else
{
Integer protectedContentId = ContentControllerProxy.getController().getProtectedContentId(contentVersionVO.getContentId());
if(protectedContentId != null && !AccessRightController.getController().getIsPrincipalAuthorized(infoGluePrincipal, "Content.Read", protectedContentId.toString()))
ceb.add(new AccessConstraintException("Content.contentId", "1000"));
}
}
}
else if(interceptionPointVO.getName().equalsIgnoreCase("ContentVersion.Write"))
{
Integer contentVersionId = (Integer)extradata.get("contentVersionId");
ContentVersionVO contentVersionVO = ContentVersionControllerProxy.getController().getContentVersionVOWithId(contentVersionId);
if(!allowCreatorAccess || !contentVersionVO.getVersionModifier().equalsIgnoreCase(infoGluePrincipal.getName()))
{
if(ContentVersionControllerProxy.getController().getIsContentProtected(contentVersionVO.getContentId(), false) && !AccessRightController.getController().getIsPrincipalAuthorized(infoGluePrincipal, "ContentVersion.Write", contentVersionId.toString()))
{
ceb.add(new AccessConstraintException("ContentVersion.contentVersionId", "1001"));
}
else
{
Integer protectedContentId = ContentControllerProxy.getController().getProtectedContentId(contentVersionVO.getContentId());
if(protectedContentId != null && !AccessRightController.getController().getIsPrincipalAuthorized(infoGluePrincipal, "Content.Write", protectedContentId.toString()))
ceb.add(new AccessConstraintException("Content.contentId", "1001"));
}
}
}
else if(interceptionPointVO.getName().equalsIgnoreCase("ContentVersion.Delete"))
{
Integer contentVersionId = (Integer)extradata.get("contentVersionId");
ContentVersionVO contentVersionVO = ContentVersionControllerProxy.getController().getContentVersionVOWithId(contentVersionId);
if(!allowCreatorAccess || !contentVersionVO.getVersionModifier().equalsIgnoreCase(infoGluePrincipal.getName()))
{
if(ContentVersionControllerProxy.getController().getIsContentProtected(contentVersionVO.getContentId(), false) && !AccessRightController.getController().getIsPrincipalAuthorized(infoGluePrincipal, "ContentVersion.Delete", contentVersionId.toString()))
ceb.add(new AccessConstraintException("ContentVersion.contentVersionId", "1003"));
}
}
else if(interceptionPointVO.getName().equalsIgnoreCase("SiteNodeVersion.Read"))
{
Integer siteNodeVersionId = (Integer)extradata.get("siteNodeVersionId");
SiteNodeVersionVO siteNodeVersionVO = SiteNodeVersionController.getController().getSiteNodeVersionVOWithId(siteNodeVersionId);
if(!allowCreatorAccess || !siteNodeVersionVO.getVersionModifier().equalsIgnoreCase(infoGluePrincipal.getName()))
{
Integer protectedSiteNodeVersionId = SiteNodeVersionControllerProxy.getSiteNodeVersionControllerProxy().getProtectedSiteNodeVersionId(siteNodeVersionId);
if(protectedSiteNodeVersionId != null && !AccessRightController.getController().getIsPrincipalAuthorized(infoGluePrincipal, "SiteNodeVersion.Read", protectedSiteNodeVersionId.toString()))
ceb.add(new AccessConstraintException("SiteNodeVersion.siteNodeVersionId", "1000"));
}
}
else if(interceptionPointVO.getName().equalsIgnoreCase("SiteNodeVersion.Write"))
{
Integer siteNodeVersionId = (Integer)extradata.get("siteNodeVersionId");
SiteNodeVersionVO siteNodeVersionVO = SiteNodeVersionController.getController().getSiteNodeVersionVOWithId(siteNodeVersionId);
if(!allowCreatorAccess || !siteNodeVersionVO.getVersionModifier().equalsIgnoreCase(infoGluePrincipal.getName()))
{
Integer protectedSiteNodeVersionId = SiteNodeVersionControllerProxy.getSiteNodeVersionControllerProxy().getProtectedSiteNodeVersionId(siteNodeVersionId);
if(protectedSiteNodeVersionId != null && !AccessRightController.getController().getIsPrincipalAuthorized(infoGluePrincipal, "SiteNodeVersion.Write", protectedSiteNodeVersionId.toString()))
ceb.add(new AccessConstraintException("SiteNodeVersion.siteNodeVersionId", "1001"));
}
}
else if(interceptionPointVO.getName().equalsIgnoreCase("SiteNodeVersion.CreateSiteNode"))
{
Integer parentSiteNodeId = (Integer)extradata.get("siteNodeId");
SiteNodeVersionVO siteNodeVersionVO = SiteNodeVersionController.getController().getLatestSiteNodeVersionVO(parentSiteNodeId);
if(!allowCreatorAccess || !siteNodeVersionVO.getVersionModifier().equalsIgnoreCase(infoGluePrincipal.getName()))
{
Integer protectedSiteNodeVersionId = SiteNodeVersionControllerProxy.getSiteNodeVersionControllerProxy().getProtectedSiteNodeVersionId(siteNodeVersionVO.getId());
if(protectedSiteNodeVersionId != null && !AccessRightController.getController().getIsPrincipalAuthorized(infoGluePrincipal, "SiteNodeVersion.CreateSiteNode", protectedSiteNodeVersionId.toString()))
ceb.add(new AccessConstraintException("SiteNodeVersion.siteNodeId", "1002"));
}
}
else if(interceptionPointVO.getName().equalsIgnoreCase("SiteNodeVersion.DeleteSiteNode"))
{
Integer siteNodeId = (Integer)extradata.get("siteNodeId");
SiteNodeVersionVO siteNodeVersionVO = SiteNodeVersionController.getController().getLatestSiteNodeVersionVO(siteNodeId);
if(!allowCreatorAccess || (siteNodeVersionVO != null && !siteNodeVersionVO.getVersionModifier().equalsIgnoreCase(infoGluePrincipal.getName())))
{
Integer protectedSiteNodeVersionId = SiteNodeVersionControllerProxy.getSiteNodeVersionControllerProxy().getProtectedSiteNodeVersionId(siteNodeVersionVO.getId());
if(protectedSiteNodeVersionId != null && !AccessRightController.getController().getIsPrincipalAuthorized(infoGluePrincipal, "SiteNodeVersion.DeleteSiteNode", protectedSiteNodeVersionId.toString()))
ceb.add(new AccessConstraintException("SiteNodeVersion.siteNodeId", "1003"));
}
}
else if(interceptionPointVO.getName().equalsIgnoreCase("SiteNodeVersion.MoveSiteNode"))
{
Integer siteNodeId = (Integer)extradata.get("siteNodeId");
SiteNodeVersionVO siteNodeVersionVO = SiteNodeVersionController.getController().getLatestSiteNodeVersionVO(siteNodeId);
if(!allowCreatorAccess || !siteNodeVersionVO.getVersionModifier().equalsIgnoreCase(infoGluePrincipal.getName()))
{
Integer protectedSiteNodeVersionId = SiteNodeVersionControllerProxy.getSiteNodeVersionControllerProxy().getProtectedSiteNodeVersionId(siteNodeVersionVO.getId());
if(protectedSiteNodeVersionId != null && !AccessRightController.getController().getIsPrincipalAuthorized(infoGluePrincipal, "SiteNodeVersion.MoveSiteNode", protectedSiteNodeVersionId.toString()))
ceb.add(new AccessConstraintException("SiteNodeVersion.siteNodeId", "1004"));
}
}
else if(interceptionPointVO.getName().equalsIgnoreCase("SiteNodeVersion.SubmitToPublish"))
{
Integer siteNodeVersionId = (Integer)extradata.get("siteNodeVersionId");
SiteNodeVersionVO siteNodeVersionVO = SiteNodeVersionController.getController().getSiteNodeVersionVOWithId(siteNodeVersionId);
if(!allowCreatorAccess || !siteNodeVersionVO.getVersionModifier().equalsIgnoreCase(infoGluePrincipal.getName()))
{
Integer protectedSiteNodeVersionId = SiteNodeVersionControllerProxy.getSiteNodeVersionControllerProxy().getProtectedSiteNodeVersionId(siteNodeVersionId);
if(protectedSiteNodeVersionId != null && !AccessRightController.getController().getIsPrincipalAuthorized(infoGluePrincipal, "SiteNodeVersion.SubmitToPublish", protectedSiteNodeVersionId.toString()))
ceb.add(new AccessConstraintException("SiteNodeVersion.siteNodeId", "1005"));
}
}
else if(interceptionPointVO.getName().equalsIgnoreCase("SiteNodeVersion.ChangeAccessRights"))
{
Integer siteNodeVersionId = (Integer)extradata.get("siteNodeVersionId");
SiteNodeVersionVO siteNodeVersionVO = SiteNodeVersionController.getController().getSiteNodeVersionVOWithId(siteNodeVersionId);
if(!allowCreatorAccess || !siteNodeVersionVO.getVersionModifier().equalsIgnoreCase(infoGluePrincipal.getName()))
{
Integer protectedSiteNodeVersionId = SiteNodeVersionControllerProxy.getSiteNodeVersionControllerProxy().getProtectedSiteNodeVersionId(siteNodeVersionId);
if(protectedSiteNodeVersionId != null && !AccessRightController.getController().getIsPrincipalAuthorized(infoGluePrincipal, "SiteNodeVersion.ChangeAccessRights", protectedSiteNodeVersionId.toString()))
ceb.add(new AccessConstraintException("SiteNodeVersion.siteNodeId", "1006"));
}
}
ceb.throwIfNotEmpty();
}