Skip to content

Commit c78d17f

Browse files
committed
Merge branch 'hotfix'
2 parents 817c8ff + 599635b commit c78d17f

5 files changed

Lines changed: 89 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Change Log
22

3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7+
8+
## v4.1.17-alpha
9+
- Lock `gulp-uf-bundle-assets` at v2.28.0 until Silic0nS0ldier/gulp-uf-bundle-assets#5 is resolved (see #859)
10+
- Add missing getInfo methods for GroupController and RoleController (#837)
11+
312
## v4.1.16-alpha
413
- Fix for `merge` bundling rule (#660)
514
- Fix for undefined variable exception under strict mode in `ufAlerts` (#809)

app/defines.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace UserFrosting;
44

55
// Some standard defines
6-
define('UserFrosting\VERSION', '4.1.16-alpha');
6+
define('UserFrosting\VERSION', '4.1.17-alpha');
77
define('UserFrosting\DS', '/');
88
define('UserFrosting\PHP_MIN_VERSION', '5.6');
99
define('UserFrosting\DEBUG_CONFIG', false);

app/sprinkles/admin/src/Controller/GroupController.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,45 @@ public function delete($request, $response, $args)
200200
return $response->withStatus(200);
201201
}
202202

203+
/**
204+
* Returns info for a single group.
205+
*
206+
* This page requires authentication.
207+
* Request type: GET
208+
*/
209+
public function getInfo($request, $response, $args)
210+
{
211+
/** @var UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager */
212+
$authorizer = $this->ci->authorizer;
213+
214+
/** @var UserFrosting\Sprinkle\Account\Database\Models\User $currentUser */
215+
$currentUser = $this->ci->currentUser;
216+
217+
// Access-controlled page
218+
if (!$authorizer->checkAccess($currentUser, 'uri_groups')) {
219+
throw new ForbiddenException();
220+
}
221+
222+
$slug = $args['slug'];
223+
224+
/** @var UserFrosting\Sprinkle\Core\Util\ClassMapper $classMapper */
225+
$classMapper = $this->ci->classMapper;
226+
227+
$group = $classMapper->staticMethod('group', 'where', 'slug', $slug)->first();
228+
229+
// If the group doesn't exist, return 404
230+
if (!$group) {
231+
throw new NotFoundException($request, $response);
232+
}
233+
234+
// Get group
235+
$result = $group->toArray();
236+
237+
// Be careful how you consume this data - it has not been escaped and contains untrusted user-supplied content.
238+
// For example, if you plan to insert it into an HTML DOM, you must escape it on the client side (or use client-side templating).
239+
return $response->withJson($result, 200, JSON_PRETTY_PRINT);
240+
}
241+
203242
/**
204243
* Returns a list of Groups
205244
*

app/sprinkles/admin/src/Controller/RoleController.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,45 @@ public function delete($request, $response, $args)
199199
return $response->withStatus(200);
200200
}
201201

202+
/**
203+
* Returns info for a single role, along with associated permissions.
204+
*
205+
* This page requires authentication.
206+
* Request type: GET
207+
*/
208+
public function getInfo($request, $response, $args)
209+
{
210+
/** @var UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager */
211+
$authorizer = $this->ci->authorizer;
212+
213+
/** @var UserFrosting\Sprinkle\Account\Database\Models\User $currentUser */
214+
$currentUser = $this->ci->currentUser;
215+
216+
// Access-controlled page
217+
if (!$authorizer->checkAccess($currentUser, 'uri_roles')) {
218+
throw new ForbiddenException();
219+
}
220+
221+
$slug = $args['slug'];
222+
223+
/** @var UserFrosting\Sprinkle\Core\Util\ClassMapper $classMapper */
224+
$classMapper = $this->ci->classMapper;
225+
226+
$role = $classMapper->staticMethod('role', 'where', 'slug', $slug)->first();
227+
228+
// If the role doesn't exist, return 404
229+
if (!$role) {
230+
throw new NotFoundException($request, $response);
231+
}
232+
233+
// Get role
234+
$result = $role->load('permissions')->toArray();
235+
236+
// Be careful how you consume this data - it has not been escaped and contains untrusted user-supplied content.
237+
// For example, if you plan to insert it into an HTML DOM, you must escape it on the client side (or use client-side templating).
238+
return $response->withJson($result, 200, JSON_PRETTY_PRINT);
239+
}
240+
202241
/**
203242
* Returns a list of Roles
204243
*

build/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"license": "MIT",
1212
"devDependencies": {
1313
"gulp": "^3.9.1",
14-
"gulp-uf-bundle-assets": "^2.27.2",
14+
"gulp-uf-bundle-assets": "2.28.0",
1515
"gulp-load-plugins": "^1.4.0",
1616
"merge-array-object": "^1.0.3",
1717
"recursive-copy": "^2.0.5",

0 commit comments

Comments
 (0)