Package org.pentaho.platform.api.repository2.unified

Examples of org.pentaho.platform.api.repository2.unified.RepositoryFileSid


  // ~ Methods
  // =========================================================================================================

  public static RepositoryFileSid everyone() {
    return new RepositoryFileSid( userNameUtils.getPrincipleId( null, "__everyone__" ), ROLE );
  }
View Full Code Here


  public static RepositoryFileSid everyone() {
    return new RepositoryFileSid( userNameUtils.getPrincipleId( null, "__everyone__" ), ROLE );
  }

  public static RepositoryFileSid root() {
    return new RepositoryFileSid( userNameUtils.getPrincipleId( null, "__root__" ), USER );
  }
View Full Code Here

    if ( entityAcl == null ) {
      return null;
    }

    ArrayList<RepositoryFileAce> repositoryFileAces = new ArrayList<RepositoryFileAce>();
    RepositoryFileSid rfs;
    for ( EntityAcl.Aces ace : entityAcl.getAces() ) {
      rfs = getSid( ace.getRecipient(), ace.getRecipientType() );
      HashSet<RepositoryFilePermission> permissionSet = new HashSet<RepositoryFilePermission>();
      for ( String permission : ace.getPermissions() ) {
        permissionSet.add( getPermission( permission ) );
View Full Code Here

      typevalue = RepositoryFileSid.Type.valueOf( type );
    } catch ( IllegalArgumentException e ) {
      throw new ExportManifestFormatException( Messages.getInstance().getString(
          "ExportManifestFormatException.invalidRepositoryFileSidType", type ), e );
    }
    return new RepositoryFileSid( name, typevalue );
  }
View Full Code Here

    return mockRepositoryFile;
  }

  private RepositoryFileAcl createMockRepositoryAcl( Serializable id, String owner, boolean entriesInheriting,
      List<RepositoryFileAce> aces ) {
    RepositoryFileSid ownerSid = new RepositoryFileSid( owner );
    return new RepositoryFileAcl( id, ownerSid, entriesInheriting, aces );
  }
View Full Code Here

        && ( getImportSession().isApplyAclSettings() || getImportSession().isRetainOwnership() ) ) {
      RepositoryFileAcl manifestAcl = repositoryFileAcl;
      RepositoryFileAcl originalAcl = repository.getAcl( repositoryFile.getId() );

      // Determine who will own this file
      RepositoryFileSid newOwner;
      if ( getImportSession().isRetainOwnership() ) {
        if ( newFile ) {
          getLogger().debug( "Getting Owner from Session" );
          newOwner = new RepositoryFileSid( PentahoSessionHolder.getSession().getName(), RepositoryFileSid.Type.USER );
        } else {
          getLogger().debug( "Getting Owner from existing file" );
          newOwner = originalAcl.getOwner();
        }
      } else {
        getLogger().debug( "Getting Owner from Manifest" );
        newOwner = manifestAcl.getOwner();
      }

      // Determine the Aces we will use for this file
      RepositoryFileAcl useAclForPermissions; // The ACL we will use the permissions from
      if ( getImportSession().isApplyAclSettings() && ( getImportSession().isOverwriteAclSettings() || newFile ) ) {
        getLogger().debug( "Getting permissions from Manifest" );
        useAclForPermissions = manifestAcl;
      } else {
        if ( newFile ) {
          getLogger().debug( "Getting permissions from Default settings" );
          useAclForPermissions = getDefaultAcl( repositoryFile );
        } else {
          getLogger().debug( "Getting permissions from existing file" );
          useAclForPermissions = originalAcl;
        }
      }

      // Make the new Acl if it has changed from the orignal
      if ( !newOwner.equals( originalAcl.getOwner() ) || !useAclForPermissions.equals( originalAcl ) ) {
        RepositoryFileAcl updatedAcl =
            new RepositoryFileAcl( repositoryFile.getId(), newOwner, useAclForPermissions.isEntriesInheriting(),
                useAclForPermissions.getAces() );
        repository.updateAcl( updatedAcl );
      }
View Full Code Here

  }

  private RepositoryFileAce createMockAce( String recipientName, String recipientType, RepositoryFilePermission first,
      RepositoryFilePermission... rest ) {
    RepositoryFileSid.Type type = RepositoryFileSid.Type.valueOf( recipientType );
    RepositoryFileSid recipient = new RepositoryFileSid( recipientName, type );
    return new RepositoryFileAce( recipient, EnumSet.of( first, rest ) );
  }
View Full Code Here

  protected void createEtcMetadaFolder( final ITenant tenant ) {
    try {
      txnTemplate.execute( new TransactionCallbackWithoutResult() {
        @Override
        public void doInTransactionWithoutResult( final TransactionStatus status ) {
          final RepositoryFileSid repositoryAdminUserSid =
              new RepositoryFileSid( userNameUtils.getPrincipleId( tenant, repositoryAdminUsername ) );
          RepositoryFile tenantEtcFolder =
              repositoryFileDao.getFileByAbsolutePath( ServerRepositoryPaths.getTenantEtcFolderPath( tenant ) );
          Assert.notNull( tenantEtcFolder );

          if ( repositoryFileDao.getFileByAbsolutePath( ServerRepositoryPaths.getTenantEtcFolderPath( tenant )
View Full Code Here

  protected void createEtcMondrianFolder( final ITenant tenant ) {
    txnTemplate.execute( new TransactionCallbackWithoutResult() {
      @Override
      public void doInTransactionWithoutResult( final TransactionStatus status ) {
        final RepositoryFileSid repositoryAdminUserSid =
            new RepositoryFileSid( userNameUtils.getPrincipleId( tenant, repositoryAdminUsername ) );
        RepositoryFile tenantEtcFolder =
            repositoryFileDao.getFileByAbsolutePath( ServerRepositoryPaths.getTenantEtcFolderPath( tenant ) );
        Assert.notNull( tenantEtcFolder );

        if ( repositoryFileDao.getFileByAbsolutePath( ServerRepositoryPaths.getTenantEtcFolderPath( tenant )
View Full Code Here

          if ( tenant == null || tenant.getId() == null ) {
            tenant = JcrTenantUtils.getDefaultTenant();
          }
          RepositoryFile userHomeFolder = null;
          String userId = userNameUtils.getPrincipleId( theTenant, username );
          final RepositoryFileSid userSid = new RepositoryFileSid( userId );
          RepositoryFile tenantHomeFolder = null;
          RepositoryFile tenantRootFolder = null;
          // Get the Tenant Root folder. If the Tenant Root folder does not exist then exit.
          tenantRootFolder =
            repositoryFileDao.getFileByAbsolutePath( ServerRepositoryPaths.getTenantRootFolderPath( theTenant ) );
          if ( tenantRootFolder != null ) {
            // Try to see if Tenant Home folder exist
            tenantHomeFolder =
              repositoryFileDao.getFileByAbsolutePath( ServerRepositoryPaths.getTenantHomeFolderPath( theTenant ) );
            if ( tenantHomeFolder == null ) {
              String ownerId = userNameUtils.getPrincipleId( theTenant, username );
              RepositoryFileSid ownerSid = new RepositoryFileSid( ownerId, RepositoryFileSid.Type.USER );

              String tenantAuthenticatedRoleId = roleNameUtils.getPrincipleId( theTenant, tenantAuthenticatedRoleName );
              RepositoryFileSid tenantAuthenticatedRoleSid =
                new RepositoryFileSid( tenantAuthenticatedRoleId, RepositoryFileSid.Type.ROLE );

              aclsForTenantHomeFolder =
                new RepositoryFileAcl.Builder( userSid ).ace( tenantAuthenticatedRoleSid, EnumSet
                  .of( RepositoryFilePermission.READ ) );

              aclsForUserHomeFolder =
                new RepositoryFileAcl.Builder( userSid ).ace( ownerSid, EnumSet.of( RepositoryFilePermission.ALL ) );
              tenantHomeFolder =
                repositoryFileDao.createFolder( tenantRootFolder.getId(), new RepositoryFile.Builder(
                  ServerRepositoryPaths.getTenantHomeFolderName() ).folder( true ).build(), aclsForTenantHomeFolder
                  .build(), "tenant home folder" );
            } else {
              String ownerId = userNameUtils.getPrincipleId( theTenant, username );
              RepositoryFileSid ownerSid = new RepositoryFileSid( ownerId, RepositoryFileSid.Type.USER );
              aclsForUserHomeFolder =
                new RepositoryFileAcl.Builder( userSid ).ace( ownerSid, EnumSet.of( RepositoryFilePermission.ALL ) );
            }

            // now check if user's home folder exist
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.repository2.unified.RepositoryFileSid

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.