ElgarL / GroupManager

The original permission plug-in for Spigot/Bukkit.
https://elgarl.github.io/GroupManager/
GNU General Public License v3.0
80 stars 36 forks source link

[Related to: Planned MySQL Support] Option for making certain globalgroups/groups not using MySQL #81

Closed TheJoshue closed 2 years ago

TheJoshue commented 2 years ago

If a group (in groups.yml) has an additional (optional) option like "mysql: false", this will make that specific group to be excluded from registering/storing/importing it on MySQL database (if plugin is using MYSQL mode).

Why this is useful (example):

So we connect GroupManager to MySQL database on server SURVIVAL. We add group "VIP" in the groups.yml with option "mysql: false".

* We now have group "VIP" that will never be imported outside of local storage system, safe from making it global/BungeeCord!

However, we connect GroupManager to MySQL database, this time on server FACTIONS We add group "VIP" in the groups.yml with option no "mysql" option.

* What we have done now is that group "VIP" will be imported to MySQL database for server FACTIONS, but still excluded to any other server that has MySQL connection established with same database and has this same group with option mysql: false

This can be very neat if you want to have some groups across whole network (BungeeCord support), where you have some certain groups that are only local and players who has those ranks will only have them on a specific server where it is given to them, they won't have that group synchronized to the MySQL database because the group has "mysql: false" option.

If this option ("mysql: <boolean>") is true, and there is established MySQL database connection, this option will have no effect because it'll still mean that the group should be stored on MySQL database. However, in same case scenario (MySQL connection enabled and established), but this time the group has "mysql: false", this group will be excluded from MySQL database storing entirely and become fully local group (stored in file or however it's best but local, not on MySQL).

example part groups.yml:

groups:
  Architect:
    default: false
    permissions:
    - some.permission.default
    inheritance: []
    info:
      prefix: '&7'
      build: true
      suffix: ''

# Adding "mysql: false" because (if we assume) MySQL connection is enabled in main config and established
# with database server, this will exclude this group from being processed and imported to the MySQL database.
#
# * So by setting "mysql: false", we are actually making group "Builder" to be LOCAL, never imported to database
# for global/BungeeCord use (considering MySQL connection is enabled in main config).
  Builder:
    default: false
    mysql: false   # <----------
    permissions:
    - some.permission.vip
    inheritance: []
    info:
      prefix: '&6'
      build: true
      suffix: ''

Usage Let's say we have 2 servers: — CreativeFactions

Let's say all our groups are: — Default — Architect — Builder — Admin


So, our intention is: Have group "Architect" only on "Factions" server, and have group "Builder" only on "Creative" server

And how we achieve this? This feature request explains it!

* This could be applicable for both groups/globalgroups (or maybe only groups because it's easier to have it in thought, especially because groups will use some sets from globalgroups)

ElgarL commented 2 years ago

I'm going to say no for this one (for now). The way its all designed is its all flat file or SQL. Excluding specific groups would require quite the rewrite as we'd have to load all local files, then decide what needs to be fetched from SQL.