sonicnkt / glauth-ui

Glauth management ui created with python/flask
MIT License
85 stars 19 forks source link

Add raw user config #28

Open Zen3515 opened 1 year ago

Zen3515 commented 1 year ago

I decided to implement raw user config to quickly bring new features of GLAuth to the UI, without much dev time.

For instance, we can add all the new complex feature of GLAuth by just typing in the raw config like this

Raw config filed:


  loginShell = "/bin/sh"
  homeDir = "/root"
  sshkeys = ["ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEA3UKCEllO2IZXgqNygiVb+dDLJJwVw3AJwV34t2jzR+/tUNVeJ9XddKpYQektNHsFmY93lJw5QDSbeH/mAC4KPoUM47EriINKEelRbyG4hC/ko/e2JWqEclPS9LP7GtqGmscXXo4JFkqnKw4TIRD52XI9n1syYM9Y8rJ88fjC/Lpn+01AB0paLVIfppJU35t0Ho9doHAEfEvcQA6tcm7FLJUvklAxc8WUbdziczbRV40KzDroIkXAZRjX7vXXhh/p7XBYnA0GO8oTa2VY4dTQSeDAUJSUxbzevbL0ll9Gi1uYaTDQyE5gbn2NfJSqq0OYA+3eyGtIVjFYZgi+txSuhw== rsa-key-20160209"]
  passappsha256 = [
    "c32255dbf6fd6b64883ec8801f793bccfa2a860f2b1ae1315cd95cdac1338efa", # TestAppPw1
    "c9853d5f2599e90497e9f8cc671bd2022b0fb5d1bd7cfff92f079e8f8f02b8d3", # TestAppPw2
    "4939efa7c87095dacb5e7e8b8cfb3a660fa1f5edcc9108f6d7ec20ea4d6b3a88", # TestAppPw3
  ]

    [[users.capabilities]]
    action = "search"
    object = "*"

Which will resulted in this generated config

[[users]]
  name = "j_doe"
  givenname = "Jane"
  sn = "Doe"
  mail = "jane.doe@glauth-example.com"
  uidnumber = 5001
  primarygroup = 5501
  passsha256 = "6478579e37aff45f013e14eeb30b3cc56c72ccdc310123bcdf53e0333e3f416a"
  otherGroups = [ 5551 ]
  loginShell = "/bin/sh"
  homeDir = "/root"
  sshkeys = ["ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEA3UKCEllO2IZXgqNygiVb+dDLJJwVw3AJwV34t2jzR+/tUNVeJ9XddKpYQektNHsFmY93lJw5QDSbeH/mAC4KPoUM47EriINKEelRbyG4hC/ko/e2JWqEclPS9LP7GtqGmscXXo4JFkqnKw4TIRD52XI9n1syYM9Y8rJ88fjC/Lpn+01AB0paLVIfppJU35t0Ho9doHAEfEvcQA6tcm7FLJUvklAxc8WUbdziczbRV40KzDroIkXAZRjX7vXXhh/p7XBYnA0GO8oTa2VY4dTQSeDAUJSUxbzevbL0ll9Gi1uYaTDQyE5gbn2NfJSqq0OYA+3eyGtIVjFYZgi+txSuhw== rsa-key-20160209"]
  passappsha256 = [
    "c32255dbf6fd6b64883ec8801f793bccfa2a860f2b1ae1315cd95cdac1338efa", # TestAppPw1
    "c9853d5f2599e90497e9f8cc671bd2022b0fb5d1bd7cfff92f079e8f8f02b8d3", # TestAppPw2
    "4939efa7c87095dacb5e7e8b8cfb3a660fa1f5edcc9108f6d7ec20ea4d6b3a88", # TestAppPw3
  ]
    [[users.capabilities]]
    action = "search"
    object = "*"

I don't think that this is the best idea ever, but I've been patiently waiting to use the new feature of newer version of GLauth for so long, but this repo seems to not be under active development.

So, my choices are

Which leaves me with a last option, the easiest way to get all the new features, is just to manually add the new feature into the config ourselves. It has some downside, but probably be fine.

I don't expect this to get merged, since I don't think it was a good idea, there is no form validation whatsoever.

PS. You can try out my new feature at my dev branch

https://github.com/Zen3515/glauth-ui https://hub.docker.com/r/zen3515/glauth-ui