51 Commits

Author SHA1 Message Date
Dylan K. Taylor
666670bc6f
PermissionAttachment may now reference zero or more permissibles
this makes PermissionAttachment more and more like Permission, except that it doesn't have a name.
Right now, the only value of this API change is that it allows breaking references to dead Permissibles, but in the future it should be possible to reuse a single PermissionAttachment on multiple Permissibles.
2021-04-12 15:57:24 +01:00
Dylan K. Taylor
c61f66d973
Removed ext-ds dependency 2021-02-11 15:40:37 +00:00
Dylan K. Taylor
bcc3e87730
Timings: rename core timers to remove 'timer' from the names
this makes them shorter and more consistent.
2020-12-23 17:52:25 +00:00
Dylan K. Taylor
61de84373a PermissionParser: simplify code 2020-12-11 19:09:01 +00:00
Dylan K. Taylor
bee770ebf5 Drop nested permissions support in plugin.yml 2020-12-11 19:03:52 +00:00
Dylan K. Taylor
794bb0a71d PermissionParser: bail on encountering permissions whose names are not strings 2020-12-09 00:32:50 +00:00
Ifera
c4b47c6c06 Implemented /clear command (#3854)
closes #3854
2020-12-06 15:26:12 +00:00
Dylan K. Taylor
0bbceee86d PermissionParser: give permissions default FALSE if they don't specify their own default 2020-12-05 21:06:07 +00:00
Dylan K. Taylor
807474b3fb PermissibleBase: do not assign any permissions by default
there is no longer such a thing as a permission granted to 'everyone', since we're no longer limited to true/false/op/notop, and regular players are now assigned the pocketmine.group.user permission.
It's possible we might want to add more restricted groups than 'user' in the future, in which case it would be behaviour-BC-breaking to change the default assigned permissions when creating a new PermissibleBase. Therefore, it's better to not assign any permissions at all and let the caller decide.
In addition, this solves the problem of implied permission subscriptions and leak on PermissibleBase construction - if base permissions are provided, it should be expected that the permissible will subscribe to those permissions.
2020-12-02 15:56:54 +00:00
Dylan K. Taylor
b51c6e89b3 Introduced pocketmine.group.console
this is only used for /dumpmemory right now, but it's planned to be used for more stuff.
2020-12-02 13:35:48 +00:00
Dylan K. Taylor
c5e12bb11f PermissibleBase: simplify diff calculation 2020-12-02 11:29:45 +00:00
Dylan K. Taylor
506e76917e PermissionAttachmentInfo now includes a reference to the PermissionAttachmentInfo that caused its assignment (if any)
this allows plugins to easily identify which permission group caused a permission to be assigned (particularly if multiple groups might cause it).
2020-12-02 11:23:35 +00:00
Dylan K. Taylor
880635603c PermissibleBase: allow injecting more dynamic base permissions 2020-12-02 10:12:40 +00:00
Dylan K. Taylor
13e8854ec0 PermissibleBase: fixed express denying of a root permission not working
this only took effect when a permission was applied as a root. When overridden with a permission attachment, the problem did not manifest.
2020-12-02 01:39:43 +00:00
Dylan K. Taylor
f5bb5c1208 Permissible->recalculatePermissions() now returns a map of changed permissions with their old values 2020-12-02 01:13:19 +00:00
Dylan K. Taylor
0634426c26 PermissibleBase: compute permission diff, do not fire callbacks when diff is empty
this fixes AvailableCommandsPacket getting sent twice when adding a PermissionAttachment.
2020-12-02 01:09:29 +00:00
Dylan K. Taylor
6720e658bd Remove useless group permission nodes
the only value these have is for convenience, and a permission manager plugin can easily generate them by parsing the permission IDs.
2020-12-02 00:00:21 +00:00
Dylan K. Taylor
1905c01c87 PermissibleBase no longer circularly references its parent permissible
this was used for 2 things:
- to notify parent permissibles on recalculate permissions (not needed anymore thanks to callbacks)
- subscription to chat broadcast permissions (now handled separately, again using callbacks)

therefore, it's no longer needed for PermissibleBase to reference its parent, meaning that we can have one less circular dependency in our lives.
2020-12-01 18:46:39 +00:00
Dylan K. Taylor
8fb74258f4 Implemented a better method for detecting permission recalculation
this allows anyone to listen to permissions being recalculated, which is useful for stuff like broadcast channel subscriptions.
2020-12-01 18:23:42 +00:00
Dylan K. Taylor
c20893aa4b PermissibleBase: more robust cycle destruction 2020-12-01 17:57:55 +00:00
Dylan K. Taylor
d602547941 PermissionAttachmentInfo no longer references Permissible
since the only way to obtain PermissionAttachmentInfo via the API is from the Permissible API, it makes zero sense to ask the attachmentinfo for its permissible, since we obviously already had it to be able to get the info in the first place. Therefore, this is just another useless reference stopping Permissibles from being garbage-collected.
2020-12-01 17:38:30 +00:00
Dylan K. Taylor
d48af3f4ca Merge branch 'stable'
# Conflicts:
#	composer.lock
#	resources/vanilla
#	src/permission/BanEntry.php
#	src/permission/PermissionAttachmentInfo.php
2020-12-01 17:35:30 +00:00
Dylan T
6d8833ccd3
Removal of permission defaults (in favour of permission cascading) (#3937) 2020-12-01 17:13:54 +00:00
Dylan K. Taylor
d56cf35385 Permissions are now always false when permission calculation hasn't been done yet
lack of permission calculation means that child permissions might not have been set correctly, so this might lead to users being able to access things they aren't supposed to.
2020-11-28 21:55:26 +00:00
Dylan K. Taylor
3e9a37ca77 PermissionParser: remove unmaintained code 2020-11-28 20:51:09 +00:00
Dylan K. Taylor
ee7fad2271 PermissibleBase: fixed root permissible being unaware of changes in some cases
for example, Player->recalculatePermissions() was not called when a player's op status changed, nor when a permission attachment altered permissions (potential secvuln for broadcasting).
2020-11-28 19:22:30 +00:00
Dylan K. Taylor
c7961bfe90 Toss ServerOperator; PermissibleBase now tracks its own op status
as well as being simpler, this also allows some nice features, such as granting memory-only op state that goes away when the player quits the server.
2020-11-28 18:22:59 +00:00
Dylan K. Taylor
4439781124 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/event/player/PlayerCreationEvent.php
2020-11-28 16:16:15 +00:00
Dylan K. Taylor
ecbc4e9433 Permission->getChildren() no longer returns by-ref 2020-11-27 20:31:59 +00:00
Dylan K. Taylor
aa67c4894f Permission: added removeChild()
this probably isn't useful at all, but it's best to provide alternatives for all the stuff that getChildren() could have been used for ...
2020-11-27 20:31:24 +00:00
Dylan K. Taylor
3849756993 Do not mutate the result of Permission->getChildren() 2020-11-27 20:28:36 +00:00
Dylan K. Taylor
f0e43a6b22 DefaultPermissions: remove ridiculous recursion
this line is totally useless since the recursion does exactly the same thing as if it wasn't there.
2020-11-27 19:59:49 +00:00
Dylan K. Taylor
1de486733a Permission: remove dead code
Bukkit CCC at its finest... what the fuck this was doing anyway I have no idea
an addChild() method would have made far more sense, especially considering that addParent() doesn't actually mutate the child.
2020-11-27 19:56:39 +00:00
Dylan K. Taylor
fb58959d5f Merge commit '189f12a644aa6474bc91650cce0eb0ae9735db91'
# Conflicts:
#	resources/vanilla
2020-05-18 10:34:00 +01:00
Dylan K. Taylor
38e28f91e8 PermissionParser: move default string mappings to const array instead of switch
this allows them to be used for validation in stuff like Respect In() rule.
2020-05-16 11:26:00 +01:00
Dylan K. Taylor
aac7da6c96 eliminate remaining empty() usages 2020-02-07 21:51:50 +00:00
Dylan K. Taylor
fb1126797a Merge branch 'stable' 2020-02-07 18:13:55 +00:00
Dylan K. Taylor
ff63f6d055 fill in more iterable types (master) 2020-02-01 20:19:57 +00:00
Dylan K. Taylor
cb16f5c142 Merge commit '260ac47588c76a2e6814cfba46773a990fb8c5da'
# Conflicts:
#	resources/vanilla
#	src/Server.php
#	src/lang/Language.php
#	src/network/mcpe/protocol/AddItemActorPacket.php
#	src/network/mcpe/protocol/AddPlayerPacket.php
#	src/network/mcpe/protocol/SetActorDataPacket.php
#	src/network/mcpe/serializer/NetworkBinaryStream.php
#	src/permission/Permission.php
#	src/pocketmine/block/Leaves.php
#	src/pocketmine/entity/DataPropertyManager.php
#	src/pocketmine/entity/Entity.php
#	src/pocketmine/item/Banner.php
#	src/pocketmine/item/Item.php
#	src/pocketmine/level/format/io/LevelProvider.php
#	src/pocketmine/level/format/io/LevelProviderManager.php
#	src/pocketmine/network/mcpe/protocol/AddActorPacket.php
#	src/pocketmine/network/mcpe/protocol/LoginPacket.php
#	src/pocketmine/tile/Banner.php
#	src/scheduler/BulkCurlTask.php
#	src/updater/AutoUpdater.php
#	src/utils/Config.php
#	src/utils/Utils.php
#	src/world/generator/Flat.php
#	src/world/generator/Generator.php
2020-01-31 21:07:34 +00:00
Dylan K. Taylor
b46712fbe9 Merge commit '58bc08838ba18df6361cede4b420d87d5973090a'
# Conflicts:
#	resources/vanilla
#	src/permission/Permission.php
2020-01-31 19:45:31 +00:00
Dylan K. Taylor
055b13a6cf strip extra blank lines (php-cs-fixer) 2020-01-22 15:14:10 +00:00
Dylan K. Taylor
cd55cdf5c6 Merge commit '9cd6b3e1c7cd81d0a4b0da68d9b3ff026c9f6495' 2020-01-22 15:04:06 +00:00
Dylan K. Taylor
1b33143f4f pass 2, manual removal of incorrect non-nullable phpdoc types 2020-01-22 12:06:47 +00:00
Dylan K. Taylor
67bcc1c0fb phpdoc armageddon for master, pass 1 2020-01-22 11:55:03 +00:00
Dylan K. Taylor
3ee6887792 populate remaining missing return types, using native returns where possible
this is done separately to stable so that stable changes can be integrated easily using an empty merge.
2020-01-19 10:26:35 +00:00
Dylan K. Taylor
cda1143a79 Merge branch 'stable' 2020-01-09 17:17:42 +00:00
Dylan K. Taylor
0f718ea28b Merge commit '8726604899d1a371567141e0831ed570d3233356' 2019-12-25 14:19:35 +00:00
Dylan K. Taylor
a9c09e4517 Merge branch 'next-minor' 2019-12-12 13:52:14 +00:00
Dylan K. Taylor
4651bcf8c3 master: imports cleanup
it was easier to make an empty merge and re-run php-cs-fixer afterwards.
2019-12-11 23:23:03 +00:00
Dylan K. Taylor
ebbb99b96b Merge branch 'next-minor' 2019-10-22 19:05:11 +01:00