// Path: src/main/java/com/orange/clara/cloud/servicedbdumper/security/useraccess/DefaultUserAccessRight.java
// public class DefaultUserAccessRight implements UserAccessRight {
//     @Override
//     public Boolean haveAccessToServiceInstance(String serviceInstanceId) {
//         return true;
//     }
// 
//     @Override
//     public Boolean haveAccessToServiceInstance(DatabaseRef databaseRef) throws UserAccessRightException {
//         return true;
//     }
// 
//     @Override
//     public Boolean haveAccessToServiceInstance(DbDumperServiceInstance dbDumperServiceInstance) throws UserAccessRightException {
//         return true;
//     }
// }


import com.orange.clara.cloud.servicedbdumper.cloudfoundry.CloudFoundryClientFactory;
import com.orange.clara.cloud.servicedbdumper.security.useraccess.CloudFoundryUserAccessRight;
import com.orange.clara.cloud.servicedbdumper.security.useraccess.DefaultUserAccessRight;
import com.orange.clara.cloud.servicedbdumper.security.useraccess.UserAccessRight;
import com.orange.clara.cloud.servicedbdumper.service.servicekey.CloudFoundryServiceKeyManager;
import com.orange.clara.cloud.servicedbdumper.service.servicekey.NoServiceKeyManager;
import com.orange.clara.cloud.servicedbdumper.service.servicekey.ServiceKeyManager;
import org.cloudfoundry.client.lib.CloudFoundryClient;
import org.cloudfoundry.client.lib.domain.CloudOrganization;
import org.cloudfoundry.client.lib.domain.CloudSpace;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import java.net.MalformedURLException;
import java.util.regex.Pattern;
    }

    @Bean
    public ServiceKeyManager serviceKeyManager() {
        if (this.cfAdminUser == null
                || this.cfAdminUser.isEmpty()
                || this.cfAdminPassword == null
                || this.cfAdminPassword.isEmpty()
                || this.cloudControllerUrl == null
                || this.cloudControllerUrl.isEmpty()
                || this.noCloudFoundryAccess) {
            return new NoServiceKeyManager();
        }
        return new CloudFoundryServiceKeyManager();
    }

    @Bean
    public String dateFormat() {
        return this.dateFormat;
    }

    @Bean(name = "userAccessRight")
    @Profile("uaa")
    public UserAccessRight getCloudFoundryUserAccessRight() {
        return new CloudFoundryUserAccessRight();
    }

    @Bean(name = "userAccessRight")
    @Profile("!uaa")
    public UserAccessRight getDefaultUserAccessRight() {
// Path: src/main/java/com/orange/clara/cloud/servicedbdumper/security/useraccess/DefaultUserAccessRight.java
// public class DefaultUserAccessRight implements UserAccessRight {
//     @Override
//     public Boolean haveAccessToServiceInstance(String serviceInstanceId) {
//         return true;
//     }
// 
//     @Override
//     public Boolean haveAccessToServiceInstance(DatabaseRef databaseRef) throws UserAccessRightException {
//         return true;
//     }
// 
//     @Override
//     public Boolean haveAccessToServiceInstance(DbDumperServiceInstance dbDumperServiceInstance) throws UserAccessRightException {
//         return true;
//     }
// }


// Path: src/main/java/com/orange/clara/cloud/servicedbdumper/config/AppConfig.java
import com.orange.clara.cloud.servicedbdumper.cloudfoundry.CloudFoundryClientFactory;
import com.orange.clara.cloud.servicedbdumper.security.useraccess.CloudFoundryUserAccessRight;
import com.orange.clara.cloud.servicedbdumper.security.useraccess.DefaultUserAccessRight;
import com.orange.clara.cloud.servicedbdumper.security.useraccess.UserAccessRight;
import com.orange.clara.cloud.servicedbdumper.service.servicekey.CloudFoundryServiceKeyManager;
import com.orange.clara.cloud.servicedbdumper.service.servicekey.NoServiceKeyManager;
import com.orange.clara.cloud.servicedbdumper.service.servicekey.ServiceKeyManager;
import org.cloudfoundry.client.lib.CloudFoundryClient;
import org.cloudfoundry.client.lib.domain.CloudOrganization;
import org.cloudfoundry.client.lib.domain.CloudSpace;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import java.net.MalformedURLException;
import java.util.regex.Pattern;

    }

    @Bean
    public ServiceKeyManager serviceKeyManager() {
        if (this.cfAdminUser == null
                || this.cfAdminUser.isEmpty()
                || this.cfAdminPassword == null
                || this.cfAdminPassword.isEmpty()
                || this.cloudControllerUrl == null
                || this.cloudControllerUrl.isEmpty()
                || this.noCloudFoundryAccess) {
            return new NoServiceKeyManager();
        }
        return new CloudFoundryServiceKeyManager();
    }

    @Bean
    public String dateFormat() {
        return this.dateFormat;
    }

    @Bean(name = "userAccessRight")
    @Profile("uaa")
    public UserAccessRight getCloudFoundryUserAccessRight() {
        return new CloudFoundryUserAccessRight();
    }

    @Bean(name = "userAccessRight")
    @Profile("!uaa")
    public UserAccessRight getDefaultUserAccessRight() {
        return new DefaultUserAccessRight();