Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 7681066

Browse files
committed
Initial commit
0 parents  commit 7681066

File tree

72 files changed

+586
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+586
-0
lines changed

Listener/User.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace YogstationPermissions\Listener;
4+
5+
use XF\Mvc\Entity\Entity;
6+
7+
class User
8+
{
9+
public static function userEntityStructure(\XF\Mvc\Entity\Manager $em, \XF\Mvc\Entity\Structure &$structure)
10+
{
11+
$structure->getters['permissions'] = true;
12+
}
13+
}

Setup.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace YogstationPermissions;
4+
5+
use XF\AddOn\AbstractSetup;
6+
use XF\AddOn\StepRunnerInstallTrait;
7+
use XF\AddOn\StepRunnerUninstallTrait;
8+
use XF\AddOn\StepRunnerUpgradeTrait;
9+
10+
use XF\Db\Schema\Alter;
11+
use XF\Db\Schema\Create;
12+
13+
14+
class Setup extends AbstractSetup
15+
{
16+
use StepRunnerInstallTrait;
17+
use StepRunnerUpgradeTrait;
18+
use StepRunnerUninstallTrait;
19+
}

XF/Entity/User.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace YogstationPermissions\XF\Entity;
4+
5+
class User extends XFCP_User {
6+
7+
/**
8+
* @return String[]
9+
*/
10+
public function getPermissions() {
11+
return ["this", "is", "a", "test"];
12+
}
13+
14+
protected function setupApiResultData(
15+
\XF\Api\Result\EntityResult $result, $verbosity = self::VERBOSITY_NORMAL, array $options = []
16+
) {
17+
parent::setupApiResultData($result, $verbosity, $options);
18+
19+
$result->permissions = $this->getPermissions();
20+
}
21+
22+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"from_class": "XF\\Entity\\User",
3+
"to_class": "YogstationPermissions\\XF\\Entity\\User",
4+
"execute_order": 10,
5+
"active": true
6+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"XF-Entity-User_YogstationPermissions-XF-Entity-User.json": {
3+
"hash": "2c81c2cf6835563462e9b5630856842a"
4+
}
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"entity_structure_de5a3429faaa73661ea76893e78c1195.json": {
3+
"hash": "080bfc61a2189a7252f5d16d1a89fda4"
4+
}
5+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"event_id": "entity_structure",
3+
"execute_order": 10,
4+
"callback_class": "YogstationPermissions\\Listener\\User",
5+
"callback_method": "userEntityStructure",
6+
"active": true,
7+
"hint": "XF\\Entity\\User",
8+
"description": "Add Yogstation Permissions to User Entity"
9+
}

_output/extension_hint.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
// ################## THIS IS A GENERATED FILE ##################
4+
// DO NOT EDIT DIRECTLY. EDIT THE CLASS EXTENSIONS IN THE CONTROL PANEL.
5+
6+
namespace YogstationPermissions\XF\Entity
7+
{
8+
class XFCP_User extends \XF\Entity\User {}
9+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"yogstationPermissions.json": {
3+
"hash": "140dffa595b4927ce8833cc4f54aab7e"
4+
}
5+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"display_order": 1,
3+
"is_moderator": false
4+
}

0 commit comments

Comments
 (0)