diff options
Diffstat (limited to 'main/app/sprinkles/admin/src/Sprunje/UserPermissionSprunje.php')
-rw-r--r-- | main/app/sprinkles/admin/src/Sprunje/UserPermissionSprunje.php | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/main/app/sprinkles/admin/src/Sprunje/UserPermissionSprunje.php b/main/app/sprinkles/admin/src/Sprunje/UserPermissionSprunje.php index f3c1734..3f4b58f 100644 --- a/main/app/sprinkles/admin/src/Sprunje/UserPermissionSprunje.php +++ b/main/app/sprinkles/admin/src/Sprunje/UserPermissionSprunje.php @@ -1,48 +1,48 @@ -<?php -/** - * UserFrosting (http://www.userfrosting.com) - * - * @link https://github.com/userfrosting/UserFrosting - * @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License) - */ - -namespace UserFrosting\Sprinkle\Admin\Sprunje; - -use Illuminate\Database\Capsule\Manager as Capsule; -use UserFrosting\Sprinkle\Core\Facades\Debug; -use UserFrosting\Support\Exception\BadRequestException; -use UserFrosting\Support\Exception\NotFoundException; - -/** - * UserPermissionSprunje - * - * Implements Sprunje for retrieving a list of permissions for a specified user. - * - * @author Alex Weissman (https://alexanderweissman.com) - */ -class UserPermissionSprunje extends PermissionSprunje -{ - protected $name = 'user_permissions'; - - /** - * {@inheritDoc} - */ - protected function baseQuery() { - // Requires a user id - if (!isset($this->options['user_id'])) { - throw new BadRequestException(); - } - - $user = $this->classMapper->staticMethod('user', 'find', $this->options['user_id']); - - // If the user doesn't exist, return 404 - if (!$user) { - throw new NotFoundException; - } - - // Get user permissions - $query = $user->permissions()->withVia('roles_via'); - - return $query; - } -} +<?php
+/**
+ * UserFrosting (http://www.userfrosting.com)
+ *
+ * @link https://github.com/userfrosting/UserFrosting
+ * @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License)
+ */
+
+namespace UserFrosting\Sprinkle\Admin\Sprunje;
+
+use Illuminate\Database\Capsule\Manager as Capsule;
+use UserFrosting\Sprinkle\Core\Facades\Debug;
+use UserFrosting\Support\Exception\BadRequestException;
+use UserFrosting\Support\Exception\NotFoundException;
+
+/**
+ * UserPermissionSprunje
+ *
+ * Implements Sprunje for retrieving a list of permissions for a specified user.
+ *
+ * @author Alex Weissman (https://alexanderweissman.com)
+ */
+class UserPermissionSprunje extends PermissionSprunje
+{
+ protected $name = 'user_permissions';
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function baseQuery() {
+ // Requires a user id
+ if (!isset($this->options['user_id'])) {
+ throw new BadRequestException();
+ }
+
+ $user = $this->classMapper->staticMethod('user', 'find', $this->options['user_id']);
+
+ // If the user doesn't exist, return 404
+ if (!$user) {
+ throw new NotFoundException;
+ }
+
+ // Get user permissions
+ $query = $user->permissions()->withVia('roles_via');
+
+ return $query;
+ }
+}
|