• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ITenant类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.pentaho.platform.api.mt.ITenant的典型用法代码示例。如果您正苦于以下问题:Java ITenant类的具体用法?Java ITenant怎么用?Java ITenant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ITenant类属于org.pentaho.platform.api.mt包,在下文中一共展示了ITenant类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createUserHomeFolder

import org.pentaho.platform.api.mt.ITenant; //导入依赖的package包/类
private void createUserHomeFolder( final ITenant theTenant, final String theUsername ) {
  IPentahoSession origPentahoSession = PentahoSessionHolder.getSession();
  Authentication origAuthentication = SecurityContextHolder.getContext().getAuthentication();

  String principleId = userNameUtils.getPrincipleId( theTenant, theUsername );
  String authenticatedRoleId = roleNameUtils.getPrincipleId( theTenant, tenantAuthenticatedRole );
  TransactionCallbackWithoutResult callback =
      PurRepositoryTestingUtils.createUserHomeDirCallback( theTenant, theUsername, principleId, authenticatedRoleId,
          repositoryFileDao );
  try {
    loginAsRepositoryAdmin();
    txnTemplate.execute( callback );
  } finally {
    PurRepositoryTestingUtils.setSession( origPentahoSession, origAuthentication );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:17,代码来源:PurRepositoryTestBase.java


示例2: createUserHomeFolder

import org.pentaho.platform.api.mt.ITenant; //导入依赖的package包/类
protected void createUserHomeFolder( final ITenant theTenant, final String theUsername ) {
  IPentahoSession origPentahoSession = PentahoSessionHolder.getSession();
  Authentication origAuthentication = SecurityContextHolder.getContext().getAuthentication();
  StandaloneSession pentahoSession = new StandaloneSession( repositoryAdminUsername );
  pentahoSession.setAuthenticated( null, repositoryAdminUsername );
  PentahoSessionHolder.setSession( pentahoSession );

  String principleId = userNameUtils.getPrincipleId( theTenant, theUsername );
  String authenticatedRoleId = roleNameUtils.getPrincipleId( theTenant, tenantAuthenticatedRoleName );
  TransactionCallbackWithoutResult callback =
      PurRepositoryTestingUtils.createUserHomeDirCallback( theTenant, theUsername, principleId, authenticatedRoleId,
          repositoryFileDao );
  try {
    txnTemplate.execute( callback );
  } finally {
    // Switch our identity back to the original user.
    PurRepositoryTestingUtils.setSession( origPentahoSession, origAuthentication );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:20,代码来源:PurRepositoryIT.java


示例3: login

import org.pentaho.platform.api.mt.ITenant; //导入依赖的package包/类
/**
 * Logs in with given username.
 * 
 * @param username
 *          username of user
 * @param tenantId
 *          tenant to which this user belongs
 * @tenantAdmin true to add the tenant admin authority to the user's roles
 */
private void login( final String username, final ITenant tenant, String[] roles ) {
  StandaloneSession pentahoSession = new StandaloneSession( username );
  pentahoSession.setAuthenticated( tenant.getId(), username );
  PentahoSessionHolder.setSession( pentahoSession );
  pentahoSession.setAttribute( IPentahoSession.TENANT_ID_KEY, tenant.getId() );
  final String password = "password";

  List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();

  if ( roles != null ) {
    for ( String roleName : roles ) {
      authorities.add( new SimpleGrantedAuthority( roleName ) );
    }
  }
  UserDetails userDetails = new User( username, password, true, true, true, true, authorities );
  Authentication auth = new UsernamePasswordAuthenticationToken( userDetails, password, authorities );
  PentahoSessionHolder.setSession( pentahoSession );
  // this line necessary for Spring Security's MethodSecurityInterceptor
  SecurityContextHolder.getContext().setAuthentication( auth );

  createUserHomeFolder( tenant, username );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:32,代码来源:UIEERepositoryDirectoryIT.java


示例4: getRolesForUser

import org.pentaho.platform.api.mt.ITenant; //导入依赖的package包/类
@Override
public List<String> getRolesForUser( ITenant iTenant, String user ) throws UsernameNotFoundException {

  /* iTenant is not supported */

  List<String> roles = new ArrayList<String>();

  try {
    UserDetails userDetails = getUserDetailsService().loadUserByUsername( user );

    if ( userDetails == null ) {
      logger.warn( "Got a null from calling the method loadUserByUsername( String username ) of UserDetailsService: "
          + getUserDetailsService()
          + ". This is an interface violation beacuse it is specified that loadUserByUsername method should never return null. Throwing a UsernameNotFoundException." );
      throw new UsernameNotFoundException( user );
    }

    Collection<? extends GrantedAuthority> authorities = userDetails.getAuthorities();

    if ( authorities != null ) {
      for ( GrantedAuthority authority : authorities ) {
        roles.add( authority.getAuthority() );
      }
    } else {
      logger.warn( "Got a null from calling the method getAuthorities() of UserDetails: " + userDetails
          + ". This is an interface violation beacuse it is specified that getAuthorities() method should never return null. Considered no GrantedAuthorities for username "
          + user );
    }

  } catch ( UsernameNotFoundException usernameNotFoundException ) {
    // The user does not exist in the UserDetailsService. Do nothing and return an empty list of roles
  }
  return roles;
}
 
开发者ID:pentaho,项目名称:pentaho-engineering-samples,代码行数:35,代码来源:PentahoSamlNativeUserRoleListService.java


示例5: getUserRoles

import org.pentaho.platform.api.mt.ITenant; //导入依赖的package包/类
@Override
public List<IPentahoRole> getUserRoles(ITenant tenant, String userName) throws UncategorizedUserRoleDaoException {
	PentahoRole role = new PentahoRole("Administrator");
	ArrayList<IPentahoRole> roles = new ArrayList<>();
	roles.add(role);
	return roles;
}
 
开发者ID:Rospaccio,项目名称:pentaho-authentication-ext,代码行数:8,代码来源:MockUserRoleDao.java


示例6: getRolesForUser

import org.pentaho.platform.api.mt.ITenant; //导入依赖的package包/类
@Override public List<String> getRolesForUser( ITenant iTenant, String s ) {
  String s1 = userDefMap.get( s );
  if ( s1 == null ) {
    return Collections.emptyList();
  }
  return Arrays.asList( s1.split( "," ) );
}
 
开发者ID:pentaho,项目名称:pentaho-osgi-bundles,代码行数:8,代码来源:MemoryUserRoleListService.java


示例7: cleanupUserAndRoles

import org.pentaho.platform.api.mt.ITenant; //导入依赖的package包/类
private void cleanupUserAndRoles( final ITenant tenant ) {
  loginAsRepositoryAdmin();
  for ( IPentahoRole role : userRoleDao.getRoles( tenant ) ) {
    userRoleDao.deleteRole( role );
  }
  for ( IPentahoUser user : userRoleDao.getUsers( tenant ) ) {
    userRoleDao.deleteUser( user );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:10,代码来源:PurRepositoryTestBase.java


示例8: login

import org.pentaho.platform.api.mt.ITenant; //导入依赖的package包/类
/**
 * Logs in with given username.
 *
 * @param username
 *          username of user
 * @param tenant
 *          tenant to which this user belongs
 * @tenantAdmin true to add the tenant admin authority to the user's roles
 */
protected void login( final String username, final ITenant tenant, String[] roles ) {
  StandaloneSession pentahoSession = new StandaloneSession( username );
  pentahoSession.setAuthenticated( tenant.getId(), username );
  PentahoSessionHolder.setSession( pentahoSession );
  pentahoSession.setAttribute( IPentahoSession.TENANT_ID_KEY, tenant.getId() );

  Authentication auth = PurRepositoryTestingUtils.createAuthentication( username, roles );
  PurRepositoryTestingUtils.setSession( pentahoSession, auth );

  createUserHomeFolder( tenant, username );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:21,代码来源:PurRepositoryIT.java


示例9: getTenant

import org.pentaho.platform.api.mt.ITenant; //导入依赖的package包/类
protected ITenant getTenant( String principalId, boolean isUser ) {
  ITenant tenant = null;
  ITenantedPrincipleNameResolver nameUtils = isUser ? userNameUtils : roleNameUtils;
  if ( nameUtils != null ) {
    tenant = nameUtils.getTenant( principalId );
  }
  if ( tenant == null || tenant.getId() == null ) {
    tenant = getCurrentTenant();
  }
  return tenant;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:12,代码来源:PurRepositoryIT.java


示例10: getCurrentTenant

import org.pentaho.platform.api.mt.ITenant; //导入依赖的package包/类
protected ITenant getCurrentTenant() {
  if ( PentahoSessionHolder.getSession() != null ) {
    String tenantId = (String) PentahoSessionHolder.getSession().getAttribute( IPentahoSession.TENANT_ID_KEY );
    return tenantId != null ? new Tenant( tenantId, true ) : null;
  } else {
    return null;
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:9,代码来源:PurRepositoryIT.java


示例11: cleanupUserAndRoles

import org.pentaho.platform.api.mt.ITenant; //导入依赖的package包/类
private void cleanupUserAndRoles( final ITenant tenant ) {
  loginAsRepositoryAdmin();
  for ( IPentahoRole role : testUserRoleDao.getRoles( tenant ) ) {
    testUserRoleDao.deleteRole( role );
  }
  for ( IPentahoUser user : testUserRoleDao.getUsers( tenant ) ) {
    testUserRoleDao.deleteUser( user );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:10,代码来源:PurRepositoryIT.java


示例12: tearDown

import org.pentaho.platform.api.mt.ITenant; //导入依赖的package包/类
@After
public void tearDown() throws Exception {
  // null out fields to get back memory
  authorizationPolicy = null;
  login( sysAdminUserName, systemTenant, new String[] { singleTenantAdminRoleName, tenantAuthenticatedRoleName } );
  ITenant tenant =
      tenantManager.getTenant( "/" + ServerRepositoryPaths.getPentahoRootFolderName() + "/" + TENANT_ID_ACME );
  if ( tenant != null ) {
    cleanupUserAndRoles( tenant );
  }
  login( sysAdminUserName, systemTenant, new String[] { singleTenantAdminRoleName, tenantAuthenticatedRoleName } );
  tenant = tenantManager.getTenant( "/" + ServerRepositoryPaths.getPentahoRootFolderName() + "/" + TENANT_ID_DUFF );
  if ( tenant != null ) {
    cleanupUserAndRoles( tenant );
  }
  cleanupUserAndRoles( systemTenant );
  SimpleJcrTestUtils.deleteItem( testJcrTemplate, ServerRepositoryPaths.getPentahoRootFolderPath() );
  logout();

  repositoryAdminUsername = null;
  singleTenantAdminRoleName = null;
  tenantAuthenticatedRoleName = null;
  // roleBindingDao = null;
  authorizationPolicy = null;
  testJcrTemplate = null;

  // null out fields to get back memory
  tenantManager = null;
  repo = null;

  mp.stop();
  mp = null;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:34,代码来源:PurRepositoryIT.java


示例13: getTenant

import org.pentaho.platform.api.mt.ITenant; //导入依赖的package包/类
private ITenant getTenant( String principalId, boolean isUser ) {
  ITenant tenant = null;
  ITenantedPrincipleNameResolver nameUtils = isUser ? userNameUtils : roleNameUtils;
  if ( nameUtils != null ) {
    tenant = nameUtils.getTenant( principalId );
  }
  if ( tenant == null || tenant.getId() == null ) {
    tenant = getCurrentTenant();
  }
  return tenant;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:12,代码来源:UIEERepositoryDirectoryIT.java


示例14: getCurrentTenant

import org.pentaho.platform.api.mt.ITenant; //导入依赖的package包/类
private ITenant getCurrentTenant() {
  if ( PentahoSessionHolder.getSession() != null ) {
    String tenantId = (String) PentahoSessionHolder.getSession().getAttribute( IPentahoSession.TENANT_ID_KEY );
    return tenantId != null ? new Tenant( tenantId, true ) : null;
  } else {
    return null;
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:9,代码来源:UIEERepositoryDirectoryIT.java


示例15: tearDown

import org.pentaho.platform.api.mt.ITenant; //导入依赖的package包/类
@After
public void tearDown() throws Exception {
  // null out fields to get back memory
  authorizationPolicy = null;
  login( sysAdminUserName, systemTenant, new String[] { singleTenantAdminRoleName, tenantAuthenticatedRoleName } );
  ITenant tenant =
      tenantManager.getTenant( "/" + ServerRepositoryPaths.getPentahoRootFolderName() + "/" + TENANT_ID_ACME );
  if ( tenant != null ) {
    cleanupUserAndRoles( tenant );
  }
  login( sysAdminUserName, systemTenant, new String[] { singleTenantAdminRoleName, tenantAuthenticatedRoleName } );
  tenant = tenantManager.getTenant( "/" + ServerRepositoryPaths.getPentahoRootFolderName() + "/" + TENANT_ID_DUFF );
  if ( tenant != null ) {
    cleanupUserAndRoles( tenant );
  }
  cleanupUserAndRoles( systemTenant );
  SimpleJcrTestUtils.deleteItem( testJcrTemplate, ServerRepositoryPaths.getPentahoRootFolderPath() );
  logout();

  repositoryAdminUsername = null;
  singleTenantAdminRoleName = null;
  tenantAuthenticatedRoleName = null;
  // roleBindingDao = null;
  authorizationPolicy = null;
  testJcrTemplate = null;

  // null out fields to get back memory
  tenantManager = null;
  repo = null;
  mp.stop();
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:32,代码来源:UIEERepositoryDirectoryIT.java


示例16: getAllRoles

import org.pentaho.platform.api.mt.ITenant; //导入依赖的package包/类
@Override
public List<String> getAllRoles( ITenant iTenant ) {
  // Return the default role as the only possible role from SAML
  return getAllRoles();
}
 
开发者ID:pentaho,项目名称:pentaho-engineering-samples,代码行数:6,代码来源:PentahoSamlNativeUserRoleListService.java


示例17: getAllUsers

import org.pentaho.platform.api.mt.ITenant; //导入依赖的package包/类
@Override
public List<String> getAllUsers( ITenant iTenant ) {
  return null; /* not supported */
}
 
开发者ID:pentaho,项目名称:pentaho-engineering-samples,代码行数:5,代码来源:PentahoSamlNativeUserRoleListService.java


示例18: getUsersInRole

import org.pentaho.platform.api.mt.ITenant; //导入依赖的package包/类
@Override
public List<String> getUsersInRole( ITenant iTenant, String role ) {

  /* iTenant is not supported */

  List<String> usersInRole = new ArrayList<String>();

  Set<String> usernameSet = Utils.getUserMap().keySet();

  for ( String username : usernameSet ) {

    List<String> userRoles = null;

    if ( ( userRoles = getRolesForUser( null, username ) ) != null ) {

      if ( userRoles.contains( role ) ) {
        usersInRole.add( username );
      }
    }
  }

  return usersInRole;
}
 
开发者ID:pentaho,项目名称:pentaho-engineering-samples,代码行数:24,代码来源:PentahoSamlNativeUserRoleListService.java


示例19: getAllRoles

import org.pentaho.platform.api.mt.ITenant; //导入依赖的package包/类
@Override
public List<String> getAllRoles( ITenant tenant ) {
  return getService().getAllRoles( tenant );
}
 
开发者ID:pentaho,项目名称:pentaho-engineering-samples,代码行数:5,代码来源:PentahoSamlUserRoleListService.java


示例20: getAllUsers

import org.pentaho.platform.api.mt.ITenant; //导入依赖的package包/类
@Override
public List<String> getAllUsers( ITenant tenant ) {
  return getService().getAllUsers( tenant );
}
 
开发者ID:pentaho,项目名称:pentaho-engineering-samples,代码行数:5,代码来源:PentahoSamlUserRoleListService.java



注:本文中的org.pentaho.platform.api.mt.ITenant类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultAdapter类代码示例发布时间:2022-05-23
下一篇:
Java ModuleDescriptor类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap