🔑 PermissionsEx v2.0 [API 5]

Hey what do you mean by wrong backend set? How’d you fix this?

Thank you for your help!

Where does the permissions file get placed? I have a fresh install running on 1.10.2. I tried to start configuring the plugin but can’t find the actual file showing the permissions. I looked at the contents of the permissions.mv.db file in the pex folder but there isn’t any of the permissions I’ve already set.

Also, anytime I try to add a user I get the ‘too many arguments’ error.

PEX now stores data in a SQL database, the permissions.mv.db. Take a look at the Getting Started guide linked in the first post to learn how to use commands.

So I started from scratch and deleted everything. Created a few groups, assigned some players, and changed some permissions. I expected to see something in the permissions.mv.db, I opened it in MySQL Workbench and only saw one line:

 H:2,block:31,blockSize:1000,chunk:1e,created:1569d8e842c,format:1,version:1e,fletcher:d02216a4

My conf (default with nothing changed):

# The list of backends able to be selected
backends {
default {
    prefix=pex
    type=sql
    url="jdbc:h2:permissions"
}
default-file {
    # Place file entries in alphabetical order
    alphabetize-entries=false
    file="permissions.json"
    type=file
}
}
# Whether to log permissions checks being performed
debug=false
default-backend=default
# Tags that apply to this server (which match with permissions blocks restricted by server-tag contexts
server-tags=[]
version=0

What do I need to change to manually edit the permissions. Basically I want to copy and paste instead of manually adding each group.

How can I achieve this?

change:
default-backend=default
to
default-backend=default-file

then a permissions.json file will be generated when u start the server

1 Like

Thankyou FiveEYZ.

Thanks exactly what I was looking for :smile:

SETTING UP PEX RAW

(my story)

(In other words, I have just newly set up a server and I NEVER had PEX on my server before. So no previous config to migrate or set up… just RAW!)

I am sorry this is long but I wanted to answer as many questions as I could. I, also, was not sure where the best place to put it was.

I want to explain first, that I am making this as simple as I can for people like me who have never used PEX before and have never had their own server or learned all the developer language. I am RAW myself, but kept searching until I found something that worked. I say, simple but do not necessarily mean short. Sometimes to keep it simple in understanding you need to add a few more words, as you will see. All this info is out there but I just think it’s easier if it’s packed into one place to get started. And this is just about getting started. Zml has plenty of info out there, including a tutorial “Getting Started with PermissionsEx 2.x” on GitHub. You will see most of this comes from that tutorial.

~ ~A small side note: At first, I was concerned because I had made some errors. I was worried that in the future they would come back to haunt me. I didn’t know how to rectify them and that bugged me. So… what I did was take PEX off my server and put it back on again. That was the easiest way I knew to get rid of any errors I may have made. As a matter of fact I did it a couple of times. Now, I have ONE ladder with my groups and inheritances setup. I have proved it… and it looks good to me! That’s all I needed… now I can go further and add permissions. There may have been a better way of doing that but that worked for me and kept me from getting frustrated.~ ~

So here is how I did it! Please remember, it is not all inclusive and anything I have done so far was from the documentation, knowledge and input of zml and others, which is readily available out there for anyone to access.

You’ll need to understand that PEX 2.x does not have a config file for YOU to configure like older bukkit versions. You need to input the info from the Server Console, and also, from the In-Game Console. For the initial setup of PEX you have to input from the Server Console. This is important to understand! At this “RAW” point in PEX there are no users, groups, inheritance, or permissions set up for anyone, including the “permission” for an owner or admin to input from the In-Game Console. (1) PEX replaces the op system completely so if you “oped” yourself prior to PEX being installed it won’t have any effect once PEX is installed! So UNTIL the “initial setup” is in play, we are not ready or able to give permissions to anyone In-Game… including ourselves.

We need to start by setting up a default user, a default group, and a default (ranking) ladder. (2) In PEX these things will be automatically created via the command data, even if you haven’t specifically added them before. You don’t need to, because when the data in the command gives “reference” to them, PEX automatically creates them. Example: in the first command below “pex default user parent add group default” There was no default user and there was no group default but because the command “references” them PEX recognizes the need for them and automatically creates them. After all, if there is no group default, how can it become the parent of the non-existent default user. PEX takes care of that. So, therefore,(2) in PEX there is no actual command to “explicitly” create a group. Once the correct command is run the subjects all come into being by the command.

With the first command I entered PEX created a default user AND the group named default AND put that user IN the group named default AND made the group default the parent of the default user. Each default user (new user) upon join will now be added to the new group named default which is the lowest group in the ranking ladder. The default user will inherit FROM the group default. (see the 1st command below)

When I entered the commands from the Server Console the readout on my server was two lines. One line telling me that the server had run the command and the other was the corresponding INFO line of what actually happened when the command was run. I include both these two lines for each command I used. (3) PLEASE NOTE even though the server readout shows a forward slash / in front of the command, when actually inputting the command into the Server Console, I did NOT use the forward slash /. It won’t work if you do. On the other hand, when you enter the command into the In-Game Console you HAVE to put the forward slash / in front of the command. It won’t work if you leave out. Also, the corresponding INFO in this case will come up on the chat screen and won’t be seen on the server.

1st command: Setting up the default user and the group default while at the same time making group default the parent of the default user. (see the command below)

   Server ran the command:  /pex default user parent add group default  
   INFO:  Added parent group default for default user in Global context

Now this takes care of “default user” and “group default”

Next, a command to create a rank ladder and add group default to it. (see the command below)

   Server ran the command: /pex rank default add group default
   INFO:  Successfully added group default to ladder default

With the next commands I set up the rest of my groups. Each one then has a parent group added to it. Remember this is just MY beginning. You can add as many or as few groups as you want.

NOTE: You can obviously name your own groups. Leave the group default the same, though. You can give it a prefix later if you desire. Also, you will see that I entered from the lowest “group default” up to the next highest group, in this case, being “Admin” with each ascending group having the group below it as its parent. That way each ascending group inherits from the parent of the lower group. For example: Member inherits from default. Member+ inherits from Member and therefore, from default. VIP inherits from Member+, and therefore, from Member and default. VIP+ inherits from VIP, and therefore, from Member+ and Member and default and so on, and so on, until, in my case, Admin inherits from all groups below it. On each group level you ONLY have to add the group just below it as the parent, you do not need to add all the other lower groups also. For example, I only need to add the group MOD as the parent of the group Admin, and yet, the group Admin will inherit from ALL the groups below it, right on down to the lowest group default.

This is how I proceeded using the same command I used above to add the group default to the ladder default. I added 6 more groups to the rank ladder default and I added them going UP the ladder with the group Admin being the top and last group I entered. Remember as you add them to the ladder PEX creates these new groups. The second command adds a parent to that group.

   Server ran the command:  /pex rank default add group Member
   INFO: Successfully added group Member  to ladder default
   Server ran the command:  /pex group Member parent add group default
   INFO:  Added parent group default for group Member in Global context

   Server ran the command:  /pex rank default add group Member+
   INFO: Successfully added group Member+  to ladder default
   Server ran the command:  /pex group Member+ parent add group Member
   INFO:  Added parent group Member for group Member+ in Global context

   Server ran the command: /pex rank default add group VIP
   INFO:  Successfully added group VIP to ladder default
   Server ran the command:  /pex group VIP parent add group Member+
   INFO:  Added parent group Member+ for group VIP in Global context

   Server ran the command: /pex rank default add group VIP+
   INFO:  Successfully added group VIP+ to ladder default
   Server ran the command:  /pex group VIP+ parent add group VIP
   INFO:  Added parent group VIP for group VIP+ in Global context

   Server ran the command: /pex rank default add group MOD
   INFO:  Successfully added group MOD to ladder default
   Server ran the command:  /pex group MOD parent add group VIP+
   INFO:  Added parent group VIP+ for group MOD in Global context

   Server ran the command: /pex rank default add group Admin
   INFO:  Successfully added group Admin to ladder default
   Server ran the command:  /pex group Admin parent add group Mod
   INFO:  Added parent group MOD for group Admin in Global context

Finally, I added the group Owner to ladder default.

   Server ran the command: /pex rank default add group Owner
   INFO:  Successfully added group Owner  to ladder default

Note, in the group Owner’s case, I will not add a parent. I will not add group Owner to any inheritance hierarchies because after the following command it will not NEED any extra permissions. (4) If you add a parent to this group after giving it ALL permissions with the following command it could open up the possibility of problematic overrides happening. Use the following command to give your top administrative group ALL commands as I did to my group Owner below.

   Server ran the command: /pex group Owner def  true
   INFO: Set default permission to 1 for group Owner in Global context

Moving right along, I now, give myself, Kokua, ALL permissions. How? I set the group Owner as the parent of Kokua, the user. I will now inherit from group Owner’s permissions. I will now be “OP!” After this I will be able to input from the In-Game Console, entering commands while setting up permissions.

   Server ran the command:  /pex user Kokua parent add group Owner
   INFO:  Added parent group Owner for user 2xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Kokua in Global context

Now Kokua has permission to use the In-Game Console and run commands. Let the fun begin!!

Next, I want to verify everything I have done. So I enter the following command on the In-Game Console, which of course, I can do for all the groups by changing “Owner” to one of the other group names. I want to find out info about the group Owner so I enter the command and the server still gives me a read out of the command

   Server says:  Kokua ran the command:  /pex group Owner info

But now my INFO comes on the In-Game chat screen

   Shown on screen In-Game:
        Information for group Owner
             Permissions:
             Global:
                Default permission: 1
             Options:
                Global:
             Parents:
                Global:		

I want to see my ladder default. Are all my groups there and in order??

Kokua ran the command:
/pex rank default

INFO shown on screen In-Game: (It has a wonderful little GUI you can work from In-Game… maybe later… not working too well right now) (My notes are in the parenthesis and do not show on screen!)

   Rank ladder default + **(*The plus sign is for adding a rank to this ladder)**
   Ranks are sorted from highest to lowest
          group Owner  -(Also, with a down arrow only beside it for demoting down the ladder and a minus sign- to remove from the ladder)
          group Admin  -(up and down arrows beside it for promoting and demoting on the ladder and a minus sign- to remove from the ladder)
          group MOD  -(up and down arrows beside it for promoting and demoting on the ladder and a minus sign- to remove from the ladder)
          group VIP+  -(up and down arrows beside it for promoting and demoting on the ladder and a minus sign- to remove from the ladder)
          group VIP  -(up and down arrows beside it for promoting and demoting on the ladder and a minus sign- to remove from the ladder)
          group Member+  -(up and down arrows beside it for promoting and demoting on the ladder and a minus sign- to remove from the ladder)
          group Member   -(up and down arrows beside it for promoting and demoting on the ladder and a minus sign- to remove from the ladder)
          group default   -(up arrow only beside it for promoting up  the ladder and a minus sign- to remove from the ladder)

You can see that all my groups are set up perfectly from bottom to top just as I entered them.

Now let’s verify user info.

Kokua ran the command: /pex user Kokua info

   Shown on screen In-Game:
          Information for user 2xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/Kokua
                 Permissions:
                 Global:
                     Default permission: 0
                 Options:
                     Global:
	                     name=Kokua
                 Parents:
                     Global:
	                     group Owner

Everything looks good so far! It shows group Owner is Kokua’s parent and therefor Kokua inherits group Owner’s permissions

Finally, I wanted to set a prefix for the group default and the group Owner.

    /pex group default option prefix &a[&4Guest&a]
    Set option prefix=&a[&4Guest&a] for group default in Global context
    /pex group Owner option prefix &3{&5*~OWNER~*&3}
    Set option prefix &3{&5*~OWNER~*&3} for group default in Global context

Below are the references noted above by the numbers prior to each reference. Not always “exact” quotes but the gist is there.

(1) Getting Started with Permissions Ex 2.x (subtitle 2 “First Run” first paragraph)
(2) Getting Started with Permissions Ex 2.x (subtitle 3 “Creating an admin group” first paragraph)
(3) Basic Permissions Setup (2nd Paragraph)
(4) Getting Started with Permissions Ex 2.x (subtitle 3 “Creating an admin group” last paragraph)

1 Like

I’m so confused… Why do I get denied when I try to use commands from EssentialCmds? I have essentialcmds.* for myself in Owner and I inherit the VIP commands it seems. Can someone explain what is wrong here? Grief Prevention seems to have added much on its own.

I am Owner, other friends are added as VIP. I can’t seem to use commands like “/time set day” or “/world setspawn”. Please advise :slight_smile:

I deleted some of the griefprevention stuff for the character limit.

{
"subjects": {
    "default": {
        "default": [
            {
                "contexts": {
                    "localip": "127.0.0.1"
                },
                "permissions-default": 1
            },
            {
                "contexts": {
                    "world": "world",
                    "gp_claim_defaults": "ADMIN"
                },
                "permissions": {
                    "griefprevention.claim.flag.block-break": -1
                }
            },
            {
                "contexts": {
                    "world": "world",
                    "gp_claim_defaults": "BASIC"
                },
                "permissions": {
                    "griefprevention.claim.flag.exit-claim": 1
                }
            },
            {
                "contexts": {
                    "world": "world",
                    "gp_claim_defaults": "WILDERNESS"
                },
                "permissions": {
                    "griefprevention.claim.flag.projectile-impact-block": 1
                }
            },
            {
                "contexts": {
                    "gp_claim_defaults": "ADMIN",
                    "world": "DIM-1"
                },
                "permissions": {
                    "griefprevention.claim.flag.exit-claim": 1
                }
            },
            {
                "contexts": {
                    "gp_claim_defaults": "BASIC",
                    "world": "DIM-1"
                },
                "permissions": {
                    "griefprevention.claim.flag.exit-claim": 1
                }
            },
            {
                "contexts": {
                    "gp_claim_defaults": "WILDERNESS",
                    "world": "DIM-1"
                },
                "permissions": {
                    "griefprevention.claim.flag.projectile-impact-block": 1
                }
            },
            {
                "contexts": {
                    "world": "DIM1",
                    "gp_claim_defaults": "ADMIN"
                },
                "permissions": {
                    "griefprevention.claim.flag.exit-claim": 1
                }
            },
            {
                "contexts": {
                    "gp_claim_defaults": "BASIC",
                    "world": "DIM1"
                },
                "permissions": {
                    "griefprevention.claim.flag.exit-claim": 1
                }
            },
            {
                "contexts": {
                    "gp_claim_defaults": "WILDERNESS",
                    "world": "DIM1"
                },
                "permissions": {
                    "griefprevention.claim.flag.projectile-impact-block": 1
                }
            },
            {
                "contexts": {
                    "world": "Abyssal_Wasteland",
                    "gp_claim_defaults": "ADMIN"
                },
                "permissions": {
                    "griefprevention.claim.flag.exit-claim": 1
                }
            },
            {
                "contexts": {
                    "world": "Abyssal_Wasteland",
                    "gp_claim_defaults": "BASIC"
                },
                "permissions": {
                    "griefprevention.claim.flag.exit-claim": 1
                }
            },
            {
                "contexts": {
                    "world": "Abyssal_Wasteland",
                    "gp_claim_defaults": "WILDERNESS"
                },
                "permissions": {
                    "griefprevention.claim.flag.projectile-impact-block": 1
                }
            },
            {
                "contexts": {
                    "world": "The_Dreadlands",
                    "gp_claim_defaults": "ADMIN"
                },
                "permissions": {
                    "griefprevention.claim.flag.exit-claim": 1
                }
            },
            {
                "contexts": {
                    "world": "The_Dreadlands",
                    "gp_claim_defaults": "BASIC"
                },
                "permissions": {
                    "griefprevention.claim.flag.exit-claim": 1
                }
            },
            {
                "contexts": {
                    "world": "The_Dreadlands",
                    "gp_claim_defaults": "WILDERNESS"
                },
                "permissions": {
                    "griefprevention.claim.flag.projectile-impact-block": 1
                }
            },
            {
                "contexts": {
                    "world": "Omothol",
                    "gp_claim_defaults": "ADMIN"
                },
                "permissions": {
                    "griefprevention.claim.flag.exit-claim": 1
                }
            },
            {
                "contexts": {
                    "gp_claim_defaults": "BASIC",
                    "world": "Omothol"
                },
                "permissions": {
                    "griefprevention.claim.flag.exit-claim": 1
                }
            },
            {
                "contexts": {
                    "gp_claim_defaults": "WILDERNESS",
                    "world": "Omothol"
                },
                "permissions": {
                    "griefprevention.claim.flag.projectile-impact-block": 1
                }
            },
            {
                "contexts": {
                    "world": "The_Dark_Realm",
                    "gp_claim_defaults": "ADMIN"
                },
                "permissions": {
                    "griefprevention.claim.flag.exit-claim": 1
                }
            },
            {
                "contexts": {
                    "world": "The_Dark_Realm",
                    "gp_claim_defaults": "BASIC"
                },
                "permissions": {
                    "griefprevention.claim.flag.block-break": -1
                }
            },
            {
                "contexts": {
                    "world": "The_Dark_Realm",
                    "gp_claim_defaults": "WILDERNESS"
                },
                "permissions": {
                    "griefprevention.claim.flag.projectile-impact-block": 1
                }
            }
        ],
        "user": [
            {
                "parents": [
                    "group:default"
                ]
            }
        ]
    },
    "group": {
        "VIP": [
            {
                "parents": [
                    "group:member"
                ],
                "permissions": {
                    "essentialcmds.home.set": 1,
                    "essentialcmds.home.use": 1,
                    "essentialcmds.home.list": 1,
                    "essentialcmds.home.delete": 1,
                    "essentialcmds.spawn.use": 1,
                    "essentialcmds.tpa.use": 1,
                    "essentialcmds.tpa.accept": 1,
                    "essentialcmds.tpahere.use": 1,
                    "essentialcmds.tpadeny.use": 1,
                    "essentialcmds.message.use": 1,
                    "essentialcmds.message.respond": 1,
                    "essentialcmds.back.use": 1,
                    "kits.use": 1,
                    "essentialcmds.afk.use": 1,
                    "kits.list": 1
                }
            }
        ],
        "Owner": [
            {
                "parents": [
                    "group:VIP"
                ],
                "permissions": {
                    "kits.*": 1,
                    "essentialcmds.*": 1
                }
            }
        ]
    },
    "user": {
        "me": [
            {
                "parents": [
                    "group:Owner"
                ],
                "options": {
                    "name": "viper2g1"
                }
            }
        ],
        "guy": [
            {
                "parents": [
                    "group:VIP"
                ]
            }
        ],
        "gal": [
            {
                "parents": [
                    "group:VIP"
                ]
            }
        ],
        "he": [
            {
                "parents": [
                    "group:VIP"
                ]
            }
        ],
        "she": [
            {
                "parents": [
                    "group:VIP"
                ]
            }
        ]
    }
},
"schema-version": 4,
"rank-ladders": {
    "default": [
        "group:default",
        "group:member",
        "group:VIP",
        "group:Owner"
    ]
},
"context-inheritance": {}
}

Output for “/pex user me info”

Information for user myid/me
Options:
Global:
name=me
Parents:
Global:
group Owner

Rank ladder:

============ Rank ladder default + =============
Ranks are sorted from highest to lowest
group Owner ▼ -
group VIP ▼ ▲ -
group member ▼ ▲ -
group default ▲ -

==================== ÂŤ Âť =====================

That is your mistake. There are no ‘*’ permissions in Sponge. Instead, just use the root permission - in this case, essentialcmds (with no .* on the end). This is a general rule for Sponge based permissions.

2 Likes

You sir, you saved me. Thank you so much.

2 Likes

there is an issue where once you are removed from a group you still have that groups permissions I just tested it with the admin group (group that gives all perms)

I set myself as admin tested that I had all commands and perms then removed myself from the admin group and I was no longer in the group but I sill had all the permissions of the group

I’m having trouble integrating PEX into my MySQL Database, is it even supported with the devbuild? (1.10 version)

And if yes, what is the correct syntax for hostname/dbname/username/password? I’m used to simple things like “user:xxx, pass:xxx” etc, not a string like that.

Thanks for your help in advance

Would it be possible to execute this PEX command in a command block? Something like this?

/pex user @p perm example.command.perm true

Having a hard time trying to find the permissions file to add permissions in mass instead of one at a time. It seems like the permissions are being stored in permissions.mv.db. How would I go about editing the information in this file?

Try do something like that inside:
config/ninja.leaping.permissionsex/ninja.leaping.permissionsex.conf

1 Like

Awesome that worked perfectly.

Is there a way to allow a user 2 prefixes? For example I could give him an Admin prefix along with a donator rank prefix.

1 Like

PermissionsEx has very little to do with how chat formatting plugins handle prefixes.

But incase your chat formatting plugin doesn’t handle arbitrary variables from SubjectData…

You could always do something like set the group “admin” prefix to “[@]” the group donator prefix to “[$]” then set the users prefix to “[@$]”

If you are asking for a way to generalize this, and not make it user specific, I’d recommend asking / looking into better support from the chat formatter.

You could do something like.
playername = [{staffPrefix}{DonatorPrefix}]{playername}
in your chat formatting plugin, where staffPrefix is a custom option as is donatorPrefix rather then using the default “prefix” option.

I hope this makes sense, as I’m not familiar with either Pex, or the chat formatter you are using.

Thanks, I’m using EssentialCMDS to handle prefixes/chat at the moment, do you happen to know a specific solution?