apache / dolphinscheduler

Apache DolphinScheduler is the modern data orchestration platform. Agile to create high performance workflow with low-code
https://dolphinscheduler.apache.org/
Apache License 2.0
12.73k stars 4.58k forks source link

[Improvement] tenant supports users of other databases like ldap #16338

Open JohnZp opened 2 months ago

JohnZp commented 2 months ago

Search before asking

Description

    private static List<String> getUserListFromLinux() throws IOException {
        List<String> userList = new ArrayList<>();
        try (
                BufferedReader bufferedReader = new BufferedReader(
                        new InputStreamReader(new FileInputStream("/etc/passwd")))) {
            String line;

            while ((line = bufferedReader.readLine()) != null) {
                if (line.contains(":")) {
                    String[] userInfo = line.split(":");
                    userList.add(userInfo[0]);
                }
            }
        }

        return userList;
    }

This method of obtaining a complete list of users is not enough. Why not use getent passwd?

Are you willing to submit a PR?

Code of Conduct

SbloodyS commented 2 months ago

Would you like to fix it? @JohnZp

JohnZp commented 2 months ago

Would you like to fix it? @JohnZp

I will try it when I have time

ruanwenjun commented 2 months ago

Can we make this to be configured? I still do not know why getent passwd is better than /etc/passwd.

JohnZp commented 2 months ago

Can we make this to be configured? I still do not know why getent passwd is better than /etc/passwd.

In my current environment, which is MRS, user creation is managed by a unified service. The users created by this service are not present in /etc/passwd, which might make my scenario somewhat unique.

SbloodyS commented 2 months ago

This command getent does not exist in all environments, we can make it configurable for users to choose.