Class AbstractJcrBackedUserRoleDao

  • All Implemented Interfaces:
    org.pentaho.platform.api.engine.security.userroledao.IUserRoleDao
    Direct Known Subclasses:
    JcrUserRoleDao

    public abstract class AbstractJcrBackedUserRoleDao
    extends Object
    implements org.pentaho.platform.api.engine.security.userroledao.IUserRoleDao
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver tenantedRoleNameUtils  
      protected org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver tenantedUserNameUtils  
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractJcrBackedUserRoleDao​(org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver userNameUtils, org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver roleNameUtils, String authenticatedRoleName, String tenantAdminRoleName, String repositoryAdminUsername, IRepositoryFileAclDao repositoryFileAclDao, IRepositoryFileDao repositoryFileDao, IPathConversionHelper pathConversionHelper, ILockHelper lockHelper, org.pentaho.platform.api.repository2.unified.IRepositoryDefaultAclHandler defaultAclHandler, List<String> systemRoles, List<String> extraRoles, org.springframework.security.core.userdetails.UserCache userDetailsCache)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean canDeleteUser​(javax.jcr.Session session, org.pentaho.platform.api.engine.security.userroledao.IPentahoUser user)
      Checks to see if the removal of the received roles and users would cause the system to have no login associated with the Admin role.
      org.pentaho.platform.api.engine.security.userroledao.IPentahoRole createRole​(javax.jcr.Session session, org.pentaho.platform.api.mt.ITenant theTenant, String roleName, String description, String[] memberUserNames)  
      org.pentaho.platform.api.engine.security.userroledao.IPentahoUser createUser​(javax.jcr.Session session, org.pentaho.platform.api.mt.ITenant theTenant, String userName, String password, String description, String[] roles)  
      protected org.pentaho.platform.api.repository2.unified.RepositoryFile createUserHomeFolder​(org.pentaho.platform.api.mt.ITenant theTenant, String username, javax.jcr.Session session)  
      void deleteRole​(javax.jcr.Session session, org.pentaho.platform.api.engine.security.userroledao.IPentahoRole role)  
      void deleteUser​(javax.jcr.Session session, org.pentaho.platform.api.engine.security.userroledao.IPentahoUser user)  
      org.pentaho.platform.api.engine.security.userroledao.IPentahoRole getRole​(javax.jcr.Session session, org.pentaho.platform.api.mt.ITenant tenant, String name)  
      List<org.pentaho.platform.api.engine.security.userroledao.IPentahoUser> getRoleMembers​(javax.jcr.Session session, org.pentaho.platform.api.mt.ITenant theTenant, String roleName)  
      List<org.pentaho.platform.api.engine.security.userroledao.IPentahoRole> getRoles​(javax.jcr.Session session)  
      List<org.pentaho.platform.api.engine.security.userroledao.IPentahoRole> getRoles​(javax.jcr.Session session, org.pentaho.platform.api.mt.ITenant tenant)  
      List<org.pentaho.platform.api.engine.security.userroledao.IPentahoRole> getRoles​(javax.jcr.Session session, org.pentaho.platform.api.mt.ITenant theTenant, boolean includeSubtenants)  
      protected static org.apache.jackrabbit.core.SessionImpl getSessionImpl​(javax.jcr.Session session)
      Our Sessions should be wrapped in a JDK Dynamic Proxy.
      org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver getTenantedRoleNameUtils()  
      org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver getTenantedUserNameUtils()  
      org.pentaho.platform.api.engine.security.userroledao.IPentahoUser getUser​(javax.jcr.Session session, org.pentaho.platform.api.mt.ITenant tenant, String name)  
      protected org.apache.commons.collections.map.LRUMap getUserCache()  
      List<org.pentaho.platform.api.engine.security.userroledao.IPentahoRole> getUserRoles​(javax.jcr.Session session, org.pentaho.platform.api.mt.ITenant theTenant, String userName)  
      List<org.pentaho.platform.api.engine.security.userroledao.IPentahoUser> getUsers​(javax.jcr.Session session)  
      List<org.pentaho.platform.api.engine.security.userroledao.IPentahoUser> getUsers​(javax.jcr.Session session, org.pentaho.platform.api.mt.ITenant tenant)  
      List<org.pentaho.platform.api.engine.security.userroledao.IPentahoUser> getUsers​(javax.jcr.Session session, org.pentaho.platform.api.mt.ITenant theTenant, boolean includeSubtenants)  
      protected void initUserCache()  
      protected void initUserDetailsCache()  
      protected boolean isMyself​(String userName)  
      boolean isUseJackrabbitUserCache()  
      void setPassword​(javax.jcr.Session session, org.pentaho.platform.api.mt.ITenant theTenant, String userName, String password)  
      void setRoleDescription​(javax.jcr.Session session, org.pentaho.platform.api.mt.ITenant theTenant, String roleName, String description)  
      void setRoleMembers​(javax.jcr.Session session, org.pentaho.platform.api.mt.ITenant theTenant, String roleName, String[] memberUserNames)  
      protected void setTenantedRoleNameUtils​(org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver roleNameUtils)  
      protected void setTenantedUserNameUtils​(org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver userNameUtils)  
      void setUseJackrabbitUserCache​(boolean useJackrabbitUserCache)  
      void setUserDescription​(javax.jcr.Session session, org.pentaho.platform.api.mt.ITenant theTenant, String userName, String description)  
      protected void setUserDetailsCache​(org.springframework.security.core.userdetails.UserCache userDetailsCache)  
      void setUserRoles​(javax.jcr.Session session, org.pentaho.platform.api.mt.ITenant theTenant, String userName, String[] roles)  
      protected boolean tenantExists​(String tenantName)  
      • Methods inherited from interface org.pentaho.platform.api.engine.security.userroledao.IUserRoleDao

        createRole, createUser, deleteRole, deleteUser, getRole, getRoleMembers, getRoles, getRoles, getRoles, getUser, getUserRoles, getUsers, getUsers, getUsers, setPassword, setRoleDescription, setRoleMembers, setUserDescription, setUserRoles
    • Field Detail

      • tenantedUserNameUtils

        protected org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver tenantedUserNameUtils
      • tenantedRoleNameUtils

        protected org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver tenantedRoleNameUtils
    • Constructor Detail

      • AbstractJcrBackedUserRoleDao

        public AbstractJcrBackedUserRoleDao​(org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver userNameUtils,
                                            org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver roleNameUtils,
                                            String authenticatedRoleName,
                                            String tenantAdminRoleName,
                                            String repositoryAdminUsername,
                                            IRepositoryFileAclDao repositoryFileAclDao,
                                            IRepositoryFileDao repositoryFileDao,
                                            IPathConversionHelper pathConversionHelper,
                                            ILockHelper lockHelper,
                                            org.pentaho.platform.api.repository2.unified.IRepositoryDefaultAclHandler defaultAclHandler,
                                            List<String> systemRoles,
                                            List<String> extraRoles,
                                            org.springframework.security.core.userdetails.UserCache userDetailsCache)
                                     throws javax.jcr.NamespaceException
        Throws:
        javax.jcr.NamespaceException
    • Method Detail

      • setRoleMembers

        public void setRoleMembers​(javax.jcr.Session session,
                                   org.pentaho.platform.api.mt.ITenant theTenant,
                                   String roleName,
                                   String[] memberUserNames)
                            throws javax.jcr.RepositoryException,
                                   org.pentaho.platform.api.engine.security.userroledao.NotFoundException
        Throws:
        javax.jcr.RepositoryException
        org.pentaho.platform.api.engine.security.userroledao.NotFoundException
      • isMyself

        protected boolean isMyself​(String userName)
      • setUserRoles

        public void setUserRoles​(javax.jcr.Session session,
                                 org.pentaho.platform.api.mt.ITenant theTenant,
                                 String userName,
                                 String[] roles)
                          throws javax.jcr.RepositoryException,
                                 org.pentaho.platform.api.engine.security.userroledao.NotFoundException
        Throws:
        javax.jcr.RepositoryException
        org.pentaho.platform.api.engine.security.userroledao.NotFoundException
      • createRole

        public org.pentaho.platform.api.engine.security.userroledao.IPentahoRole createRole​(javax.jcr.Session session,
                                                                                            org.pentaho.platform.api.mt.ITenant theTenant,
                                                                                            String roleName,
                                                                                            String description,
                                                                                            String[] memberUserNames)
                                                                                     throws org.apache.jackrabbit.api.security.user.AuthorizableExistsException,
                                                                                            javax.jcr.RepositoryException
        Throws:
        org.apache.jackrabbit.api.security.user.AuthorizableExistsException
        javax.jcr.RepositoryException
      • createUser

        public org.pentaho.platform.api.engine.security.userroledao.IPentahoUser createUser​(javax.jcr.Session session,
                                                                                            org.pentaho.platform.api.mt.ITenant theTenant,
                                                                                            String userName,
                                                                                            String password,
                                                                                            String description,
                                                                                            String[] roles)
                                                                                     throws org.apache.jackrabbit.api.security.user.AuthorizableExistsException,
                                                                                            javax.jcr.RepositoryException
        Throws:
        org.apache.jackrabbit.api.security.user.AuthorizableExistsException
        javax.jcr.RepositoryException
      • deleteRole

        public void deleteRole​(javax.jcr.Session session,
                               org.pentaho.platform.api.engine.security.userroledao.IPentahoRole role)
                        throws org.pentaho.platform.api.engine.security.userroledao.NotFoundException,
                               javax.jcr.RepositoryException
        Throws:
        org.pentaho.platform.api.engine.security.userroledao.NotFoundException
        javax.jcr.RepositoryException
      • deleteUser

        public void deleteUser​(javax.jcr.Session session,
                               org.pentaho.platform.api.engine.security.userroledao.IPentahoUser user)
                        throws org.pentaho.platform.api.engine.security.userroledao.NotFoundException,
                               javax.jcr.RepositoryException
        Throws:
        org.pentaho.platform.api.engine.security.userroledao.NotFoundException
        javax.jcr.RepositoryException
      • getRoles

        public List<org.pentaho.platform.api.engine.security.userroledao.IPentahoRole> getRoles​(javax.jcr.Session session)
                                                                                         throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getUsers

        public List<org.pentaho.platform.api.engine.security.userroledao.IPentahoUser> getUsers​(javax.jcr.Session session)
                                                                                         throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • setRoleDescription

        public void setRoleDescription​(javax.jcr.Session session,
                                       org.pentaho.platform.api.mt.ITenant theTenant,
                                       String roleName,
                                       String description)
                                throws org.pentaho.platform.api.engine.security.userroledao.NotFoundException,
                                       javax.jcr.RepositoryException
        Throws:
        org.pentaho.platform.api.engine.security.userroledao.NotFoundException
        javax.jcr.RepositoryException
      • setUserDescription

        public void setUserDescription​(javax.jcr.Session session,
                                       org.pentaho.platform.api.mt.ITenant theTenant,
                                       String userName,
                                       String description)
                                throws org.pentaho.platform.api.engine.security.userroledao.NotFoundException,
                                       javax.jcr.RepositoryException
        Throws:
        org.pentaho.platform.api.engine.security.userroledao.NotFoundException
        javax.jcr.RepositoryException
      • setPassword

        public void setPassword​(javax.jcr.Session session,
                                org.pentaho.platform.api.mt.ITenant theTenant,
                                String userName,
                                String password)
                         throws org.pentaho.platform.api.engine.security.userroledao.NotFoundException,
                                javax.jcr.RepositoryException
        Throws:
        org.pentaho.platform.api.engine.security.userroledao.NotFoundException
        javax.jcr.RepositoryException
      • setUserDetailsCache

        protected void setUserDetailsCache​(org.springframework.security.core.userdetails.UserCache userDetailsCache)
      • setTenantedUserNameUtils

        protected void setTenantedUserNameUtils​(org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver userNameUtils)
      • getTenantedUserNameUtils

        public org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver getTenantedUserNameUtils()
      • setTenantedRoleNameUtils

        protected void setTenantedRoleNameUtils​(org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver roleNameUtils)
      • getTenantedRoleNameUtils

        public org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver getTenantedRoleNameUtils()
      • getRoles

        public List<org.pentaho.platform.api.engine.security.userroledao.IPentahoRole> getRoles​(javax.jcr.Session session,
                                                                                                org.pentaho.platform.api.mt.ITenant tenant)
                                                                                         throws javax.jcr.RepositoryException,
                                                                                                javax.jcr.NamespaceException
        Throws:
        javax.jcr.RepositoryException
        javax.jcr.NamespaceException
      • getRoles

        public List<org.pentaho.platform.api.engine.security.userroledao.IPentahoRole> getRoles​(javax.jcr.Session session,
                                                                                                org.pentaho.platform.api.mt.ITenant theTenant,
                                                                                                boolean includeSubtenants)
                                                                                         throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getSessionImpl

        protected static org.apache.jackrabbit.core.SessionImpl getSessionImpl​(javax.jcr.Session session)
        Our Sessions should be wrapped in a JDK Dynamic Proxy. Unfortunately some Jackrabbit code is written against the SessionImpl concrete class. This utility unwraps the proxy.
        Parameters:
        session -
        Returns:
      • getUsers

        public List<org.pentaho.platform.api.engine.security.userroledao.IPentahoUser> getUsers​(javax.jcr.Session session,
                                                                                                org.pentaho.platform.api.mt.ITenant tenant)
                                                                                         throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getUsers

        public List<org.pentaho.platform.api.engine.security.userroledao.IPentahoUser> getUsers​(javax.jcr.Session session,
                                                                                                org.pentaho.platform.api.mt.ITenant theTenant,
                                                                                                boolean includeSubtenants)
                                                                                         throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getRole

        public org.pentaho.platform.api.engine.security.userroledao.IPentahoRole getRole​(javax.jcr.Session session,
                                                                                         org.pentaho.platform.api.mt.ITenant tenant,
                                                                                         String name)
                                                                                  throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getUser

        public org.pentaho.platform.api.engine.security.userroledao.IPentahoUser getUser​(javax.jcr.Session session,
                                                                                         org.pentaho.platform.api.mt.ITenant tenant,
                                                                                         String name)
                                                                                  throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • tenantExists

        protected boolean tenantExists​(String tenantName)
      • getRoleMembers

        public List<org.pentaho.platform.api.engine.security.userroledao.IPentahoUser> getRoleMembers​(javax.jcr.Session session,
                                                                                                      org.pentaho.platform.api.mt.ITenant theTenant,
                                                                                                      String roleName)
                                                                                               throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • getUserRoles

        public List<org.pentaho.platform.api.engine.security.userroledao.IPentahoRole> getUserRoles​(javax.jcr.Session session,
                                                                                                    org.pentaho.platform.api.mt.ITenant theTenant,
                                                                                                    String userName)
                                                                                             throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • createUserHomeFolder

        protected org.pentaho.platform.api.repository2.unified.RepositoryFile createUserHomeFolder​(org.pentaho.platform.api.mt.ITenant theTenant,
                                                                                                   String username,
                                                                                                   javax.jcr.Session session)
                                                                                            throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException
      • canDeleteUser

        protected boolean canDeleteUser​(javax.jcr.Session session,
                                        org.pentaho.platform.api.engine.security.userroledao.IPentahoUser user)
                                 throws javax.jcr.RepositoryException
        Checks to see if the removal of the received roles and users would cause the system to have no login associated with the Admin role. This check is to be made before any changes take place
        Returns:
        Error message if invalid or null if ok
        Throws:
        javax.jcr.RepositoryException
      • isUseJackrabbitUserCache

        public boolean isUseJackrabbitUserCache()
      • setUseJackrabbitUserCache

        public void setUseJackrabbitUserCache​(boolean useJackrabbitUserCache)
      • initUserCache

        protected void initUserCache()
      • getUserCache

        protected org.apache.commons.collections.map.LRUMap getUserCache()
      • initUserDetailsCache

        protected void initUserDetailsCache()