Browse permissions for store.
このコミットが含まれているのは:
コミット
f0e27920dd
@ -7,6 +7,14 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class StoreController extends Controller {
|
||||
private $objUser;
|
||||
private $objPermission;
|
||||
|
||||
public function __construct() {
|
||||
$this->objUser = new UserController();
|
||||
$this->objPermission = new PermissionController();
|
||||
}
|
||||
|
||||
// Game
|
||||
public function getGames() { // /api/rpc/store/game/getgames
|
||||
return DB::table('str_games')
|
||||
@ -479,4 +487,57 @@ class StoreController extends Controller {
|
||||
->where('id', $request->id)
|
||||
->update(['isApproved' => 0]);
|
||||
}
|
||||
|
||||
public function browsePermissions($uid) {
|
||||
// Get user ID.
|
||||
$perm = $this->objUser->getUser($uid);
|
||||
|
||||
// Does the user ID exist? Grand the appropriate rights. Otherwise, use guest.
|
||||
if ($uid != 0) {
|
||||
// Store permissions.
|
||||
$grouppermstr = $this->objPermission->getPermissionGroup('str', $perm[0]->perm_id);
|
||||
$userpermstr = $this->objPermission->getPermissionUser('str', $uid);
|
||||
|
||||
// User permissions.
|
||||
$grouppermusr = $this->objPermission->getPermissionGroup('usr', $perm[0]->perm_id);
|
||||
$userpermusr = $this->objPermission->getPermissionUser('usr', $uid);
|
||||
|
||||
// Now provide an array of user overwritten permissions if it exists. Otherwise, give its group permissions.
|
||||
$strarr = array();
|
||||
$usrarr = array();
|
||||
|
||||
if (!empty($userpermstr[0])) {
|
||||
$strarr = (array)$userpermstr[0];
|
||||
}
|
||||
else {
|
||||
$strarr = (array)$grouppermstr[0];
|
||||
}
|
||||
|
||||
if (!empty($userpermusr[0])) {
|
||||
$usrarr = (array)$userpermusr[0];
|
||||
}
|
||||
else {
|
||||
$usrarr = (array)$grouppermusr[0];
|
||||
}
|
||||
|
||||
$merge = array();
|
||||
$merge = array_merge($strarr, $usrarr);
|
||||
|
||||
return $merge;
|
||||
}
|
||||
else {
|
||||
// Store permissions.
|
||||
$grouppermstr = $this->objPermission->getPermissionGroup('str', 6);
|
||||
|
||||
// User permissions.
|
||||
$grouppermusr = $this->objPermission->getPermissionGroup('usr', 6);
|
||||
|
||||
// Since guests don't have user overwritten permissions, simply return the group permissions.
|
||||
$merge = array();
|
||||
$merge = array_merge((array)$grouppermstr[0], (array)$grouppermusr[0]);
|
||||
|
||||
return $merge;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -56,3 +56,6 @@ Route::post('/api/rpc/store/entry/upload', 'StoreController@uploadEntry');
|
||||
Route::post('/api/rpc/store/entry/update', 'StoreController@updateEntry');
|
||||
Route::post('/api/rpc/store/entry/restore', 'StoreController@restoreEntry');
|
||||
Route::post('/api/rpc/store/entry/remove', 'StoreController@removeEntry');
|
||||
|
||||
// Compiled routes.
|
||||
Route::get('/api/rpc/store/browse/browsepermissions/{uid}', 'StoreController@browsePermissions');
|
||||
|
新しいイシューから参照
ユーザーをブロックする