Exemplo n.º 1
0
 @Override
 public GroupMembership getEffectiveGroups() {
   if (effectiveGroups == null) {
     if (authConfig.isIdentityTrustable(state().getExternalIds())) {
       effectiveGroups = groupBackend.membershipsOf(this);
     } else {
       effectiveGroups = registeredGroups;
     }
   }
   return effectiveGroups;
 }
  @Override
  public List<AccountExternalId> call() throws OrmException {
    final AccountExternalId.Key last = session.getLastLoginExternalId();
    final List<AccountExternalId> ids =
        db.accountExternalIds().byAccount(user.getAccountId()).toList();

    for (final AccountExternalId e : ids) {
      e.setTrusted(authConfig.isIdentityTrustable(Collections.singleton(e)));

      // The identity can be deleted only if its not the one used to
      // establish this web session, and if only if an identity was
      // actually used to establish this web session.
      //
      if (e.isScheme(SCHEME_USERNAME)) {
        e.setCanDelete(false);
      } else {
        e.setCanDelete(last != null && !last.equals(e.getKey()));
      }
    }
    return ids;
  }