Edits to users.yaml


#1

I need a place to store some extra attributes on a per-user basis. What are your thoughts about storing these in the ~/.octoprint/users.yaml file?

michael:
  active: true
  apikey: null
  password: REDACTED
  roles:
  - user
  - admin
  settings: {}

Currently, that's what it looks like and this is what I might propose. Would this break anything?

michael:
  active: true
  apikey: null
  password: REDACTED
  roles:
  - user
  - admin
  settings: {}
  custom:
    avatar: '/home/pi/whatever/michael.png'
    fullName: 'OutsourcedGuru'
    favoriteCookie: 'Do-Si-Dos'

...or...

  custom: {'avatar': '/home/pi/whatever/michael.png', 'fullName': 'OutsourcedGuru', 'favoriteCookie': 'Do-Si-Dos'}

#2

Why not throw into the already existing user settings?


#3

I thought that was sort of yours and I didn't want to step on your toes.


#4

Nah. Not really. I built it in for situations like this, core or plugins having to store user specific data. Might make sense to create some sort of namespacing in there though.


#5

I've got a few that I'd like to store in there for this particular design. I can throw you a preliminary list next week if you'd like but it's almost set in stone at this point.

How about {'pluginid_favoriteCookies': 'Do-Si-Dos', ...} for namespacing?


#6

To match the way that IDs are generated for templates and elsewhere I'd go with plugin_<identifier>_<key>


#7

Thanks, that will be awesome. :slight_smile: