Ejemplo n.º 1
3
  public static List<StringOption> getUserSubTenantOptions() {
    List<StringOption> options = Lists.newArrayList();

    if (Security.hasAnyRole(
        Security.SECURITY_ADMIN, Security.RESTRICTED_SECURITY_ADMIN, Security.HOME_TENANT_ADMIN)) {
      TenantOrgRestRep userTenant =
          getViprClient().tenants().get(uri(Security.getUserInfo().getTenant()));
      options.add(createTenantOption(userTenant));
    }

    for (TenantOrgRestRep tenant :
        getViprClient().tenants().getByIds(Security.getUserInfo().getSubTenants())) {
      options.add(createTenantOption(tenant));
    }

    return options;
  }
Ejemplo n.º 2
2
 public static boolean canReadAllTenants() {
   return Security.hasAnyRole(
       Security.ROOT_TENANT_ADMIN, Security.SECURITY_ADMIN, Security.SYSTEM_MONITOR);
 }
Ejemplo n.º 3
0
 public boolean canEditVcenter() {
   if (Security.isSecurityAdmin()
       && !(Security.isSystemAdmin() || Security.isTenantAdmin() || isNew())) {
     return false;
   }
   return true;
 }
Ejemplo n.º 4
0
 /**
  * Checks to see if setup is complete, and it not locks out non-admin users by redirecting to a
  * static page instead of showing a forbidden error.
  */
 private static void checkCompleteAndLicensed() {
   // If setup is complete, redirect
   if (isInitialSetupComplete() && isLicensed()) {
     complete();
   }
   // If this user does not have the right roles, redirect to a static page
   if (Security.isSystemAdminOrRestrictedSystemAdmin() == false
       && Security.isSecurityAdminOrRestrictedSecurityAdmin() == false) {
     notLicensed();
   }
   if (!Common.isClusterStable()) {
     Maintenance.maintenance(request.url);
   }
 }
Ejemplo n.º 5
0
  public static List<StringOption> getSubTenantOptions() {
    List<StringOption> options = Lists.newArrayList();

    TenantOrgRestRep userTenant =
        getViprClient().tenants().get(uri(Security.getUserInfo().getTenant()));
    options.add(createTenantOption(userTenant));

    for (TenantOrgRestRep tenant :
        getViprClient().tenants().getAllSubtenants(uri(Security.getUserInfo().getTenant()))) {
      options.add(createTenantOption(tenant));
    }
    Collections.sort(options);

    return options;
  }
Ejemplo n.º 6
0
    protected Task<VcenterRestRep> createVCenter(boolean validateConnection) {
      VcenterCreateParam vcenterCreateParam = new VcenterCreateParam();
      doWriteTo(vcenterCreateParam);

      if (Security.isSystemAdmin()) {
        return VCenterUtils.createVCenter(
            vcenterCreateParam, validateConnection, getAclAssignmentChanges());
      }

      return VCenterUtils.createVCenter(
          TenantUtils.getTenantFilter(Models.currentAdminTenantForVcenter()),
          vcenterCreateParam,
          validateConnection);
    }
Ejemplo n.º 7
0
 @Override
 public UserGroupInfo performOperation(UserGroupRestRep userGroupRestRep) throws Exception {
   return new UserGroupInfo(userGroupRestRep, Security.isSecurityAdmin());
 }
Ejemplo n.º 8
0
 public static TenantOrgRestRep getUserTenant() {
   return getViprClient().tenants().get(uri(Security.getUserInfo().getTenant()));
 }