Package org.pentaho.platform.api.engine.security.userroledao

Examples of org.pentaho.platform.api.engine.security.userroledao.IPentahoUser


      throw new UserRoleException( Messages.getInstance().getErrorString(
          "UserRoleWebService.ERROR_0006_ROLE_UPDATE_FAILED", roleName ) ); //$NON-NLS-1$
    }
    Set<String> users = new HashSet<String>();
    for ( String username : usernames ) {
      IPentahoUser user = getDao().getUser( null, username );
      if ( user == null ) {
        throw new UserRoleException( Messages.getInstance().getErrorString(
            "UserRoleWebService.ERROR_0006_ROLE_UPDATE_FAILED", roleName ) ); //$NON-NLS-1$
      }
      users.add( user.getUsername() );
    }
    getDao().setRoleDescription( null, roleName, description );
    getDao().setRoleMembers( null, roleName, users.toArray( new String[0] ) );
  }
View Full Code Here


  }

  @Override
  public ProxyPentahoRole[] getRolesForUser( ProxyPentahoUser proxyUser ) throws UserRoleException {
    List<ProxyPentahoRole> proxyRoles = new ArrayList<ProxyPentahoRole>();
    IPentahoUser user = getDao().getUser( proxyUser.getTenant(), proxyUser.getName() );
    if ( user != null ) {
      for ( IPentahoRole role : getDao().getUserRoles( proxyUser.getTenant(), proxyUser.getName() ) ) {
        proxyRoles.add( ProxyPentahoUserRoleHelper.toProxyRole( role ) );
      }
    } else {
View Full Code Here

    isAdmin = true;

    service.createUser( user );

    // the last role should have the same name and description
    IPentahoUser userVerified = userRoleDao.getUser( null, "test" );
    Assert.assertNotNull( userVerified );
    Assert.assertEquals( "test", userVerified.getUsername() );
    Assert.assertEquals( "test", userVerified.getPassword() );
    Assert.assertEquals( true, userVerified.isEnabled() );
    Assert.assertEquals( "testing", userVerified.getDescription() );
  }
View Full Code Here

  private IPentahoUser convertToPentahoUser( User jackrabbitUser ) throws RepositoryException {
    if ( userCache.containsKey( jackrabbitUser.getID() ) ) {
      return (IPentahoUser) userCache.get( jackrabbitUser.getID() );
    }
    IPentahoUser pentahoUser = null;
    Value[] propertyValues = null;

    String description = null;
    try {
      propertyValues = jackrabbitUser.getProperty( "description" ); //$NON-NLS-1$
View Full Code Here

      UserManager userMgr = getUserManager( theTenant, session );
      pPrincipalName = ( (SessionImpl) session ).getJCRName( P_PRINCIPAL_NAME );
      Iterator<Authorizable> it = userMgr.findAuthorizables( pPrincipalName, null, UserManager.SEARCH_TYPE_USER );
      while ( it.hasNext() ) {
        User user = (User) it.next();
        IPentahoUser pentahoUser = convertToPentahoUser( user );
        if ( includeSubtenants ) {
          users.add( pentahoUser );
        } else {
          if ( pentahoUser.getTenant() != null && pentahoUser.getTenant().equals( theTenant ) ) {
            users.add( pentahoUser );
          }
        }
      }
    }
View Full Code Here

    public IPentahoUser createUser( ITenant tenant, String username, String password, String description,
        String[] roleNames ) throws AlreadyExistsException, UncategorizedUserRoleDaoException {
      if ( tenant == null ) {
        tenant = getDefaultTenant();
      }
      IPentahoUser user = getUser( tenant, username );
      if ( user == null ) {
        user = new PentahoUser( tenant, username, password, description, true );
        users.add( user );
        setUserRoles( tenant, username, roleNames );
      }
View Full Code Here

      if ( tenant == null ) {
        tenant = getDefaultTenant();
      }

      Set<IPentahoRole> roles = null;
      IPentahoUser pentahoUser = getUser( tenant, userName );
      if ( pentahoUser != null ) {
        roles = userRolesMap.get( pentahoUser );
      }
      return roles == null ? new ArrayList<IPentahoRole>() : new ArrayList<IPentahoRole>( roles );
    }
View Full Code Here

    public void setPassword( ITenant tenant, String userName, String password ) throws NotFoundException,
      UncategorizedUserRoleDaoException {
      if ( tenant == null ) {
        tenant = getDefaultTenant();
      }
      IPentahoUser user = getUser( tenant, userName );
      if ( user != null ) {
        user.setPassword( password );
      } else {
        throw new NotFoundException( "" );
      }
    }
View Full Code Here

      Set<IPentahoUser> members = new HashSet<IPentahoUser>();
      if ( memberUserNames == null ) {
        memberUserNames = new String[0];
      }
      for ( String memberName : memberUserNames ) {
        IPentahoUser user = getUser( tenant, memberName );
        if ( user != null ) {
          members.add( user );
        }
      }
View Full Code Here

    public void setUserDescription( ITenant tenant, String userName, String description ) throws NotFoundException,
      UncategorizedUserRoleDaoException {
      if ( tenant == null ) {
        tenant = getDefaultTenant();
      }
      IPentahoUser user = getUser( tenant, userName );
      if ( user != null ) {
        user.setDescription( description );
      } else {
        throw new NotFoundException( "" );
      }
    }
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.engine.security.userroledao.IPentahoUser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.