Getting my PEX ladder, groups and permissions straight in SQL

Discussion in 'Server & Community Management' started by gPapaJoe, May 26, 2018.

  1. In place of PEX commands for my initial setup, I used a permissions.yml file I had downloaded from somewhere and then added some edits...and now I have moved everything into SQL and I have no permissions.yml at all. With '- ~~~~~~~~~~' in place of actual permission, here is the permissions.yml I had running and working when I moved its PEX data into SQL:
    Code (Text):

    groups:
      monitor:
        build: false
        permissions:
        - ~~~~~~~~~~
        options:
          rank: '1000'
        inheritance: []
      nomad:
        inheritance:
        - monitor
        build: true
        permissions:
        - ~~~~~~~~~~
        options:
          default: 'true'
          rank: '900'
      miner:
        inheritance:
        - nomad
        permissions:
        - ~~~~~~~~~~
        options:
          rank: '800'
      member:
        inheritance:
        - miner
        permissions:
        - ~~~~~~~~~~
        options:
          rank: '700'
      modmember:
        inheritance:
        - member
        permissions:
        - ~~~~~~~~~~
        options:
          rank: '600'
      builder:
        inheritance:
        - member
        options:
          rank: '500'
        permissions: []
      devplayer:
        inheritance:
        - member
        options:
          rank: '400'
        permissions: []
      oldtimer:
        inheritance:
        - member
        options:
          rank: '10'
        permissions: []
    users:
      abc~~~:
        group:
        - oldtimer
        options:
          name: gPapaJoe
        permissions:
        - ~~~~~~~~~~
      abd~~~:
        permissions:
        - ~~~~~~~~~~
        options:
          name: ModMan
        group:
        - modmember
    schema-version: 1
     
    I have since added 'modminer' as a new group, but it does not show up along with all the others at 'pex group'. So before getting into anything else:

    1. Is there a way I can get 'modminer' into the registered list without having to start everything from scratch? For example, what about simply giving all groups a ladder name in order to bring 'modminer' in along with the others?
    2. Also, does the '#0' after each group mean PEX does not realize the members already in the working groups?

    Here is a screenshot of 'pex group modminer' plus /pex group':

    pex group 01.jpg
     
    #1 gPapaJoe, May 26, 2018
    Last edited: May 26, 2018
  2. Update: I had deleted the 'modminer' group that was not showing up along with the others at '/pex group', then this morning I again did '/pex group modminer create' and '/pex reload' and then 'modminer' began showing up as it should in the list of groups and it even had my previous '/pex group modminer set rank 650' value showing without my having run that command again.

    Go figure!
     
  3. So where are all your permission nodes kept with sql?
     
  4. I have yet to poke around to try to see exactly what is where, but here (with shortened names) are the database tables set by config.yml:

    PEX 01.png
     
  5. Strahan

    Benefactor

    Just do /pex import file to load MySQL with the permissions from the permissions.yml
     
  6. That is how I made the switch and all is well, but do you know what would happen if tried to import another permissions.yml on top of what is already in my database? For example: I had considered 're-importing' what I had already used but with a new group added, and I had also considered importing a permissions.yml with only that new group listed. But in either case, and based upon my past WordPress SQL experience, I did not do that because I the proper way to do that is to first drop all the tables in preparation for the import.
     
  7. Strahan

    Benefactor

    Dunno, lemme try it and I'll tell you what happens.

    It wipes the existing data before it reimports so you don't have to worry about everything duplicating. You'd want to add the new group to the old permissions.yml that had everything. If you import a file with just the one group, you lose everything save the new group.
     
  8. Nice. I used to use a certain MySQL feature that is no longer there to do a "replace if..." kind of thing, but I do not recall ever just sending in a backup without first dropping all the tables.
     
  9. Strahan

    Benefactor

    Dropping is a bit more of a headache as you then have to recreate the table schema. PEX is just doing a DELETE on the tables. Personally, I'd do TRUNCATE as it's cleaner but whatevs, clears either way heh.
     
  10. Understood. So then, and overall, there would be no way have PEX do an import that included a new user group while preserving what is already in the database, correct? Also, is there any way for PEX to perform an export of user data?

    I do not yet know whether PEX keeps *everything* in the database or is still using one or more flat files, and I also have yet to learn how to quickly find things such as 'last location' or 'home' coordinates for a given player.
     
  11. Strahan

    Benefactor

    You can set the backend back to file then do /pex import sql to recreate a YML file from MySQL. Edit it, then change backend to sql and import from file.

    As to the file question, once you set the backend to SQL the flat file is not relevant and won't be used.
     
  12. Ah, excellent! I had only ever known 'import' as a one-way trip into SQL and now I see!
     
  13. Strahan

    Benefactor

    Don't feel bad, I thought the same lol. It wasn't until after I posted bemoaning the lack of an export option that I thought hmmm wonder if I can import the other way if I change backend then tested the theory then edited my reply :)
     
  14. Yeah, I saw the e-mail notice for the pre-post...

    Many thanks!