示例#1
0
 public function getPermission($userId)
 {
     $db = $this->getDB();
     $scope_array = [];
     $roleModel = new roleModel();
     $list = $roleModel->listView([$this->getTable() . ".id" => $userId]);
     foreach ($list as $key => $value) {
         array_push($scope_array, "{$value['service']}.{$value['action']}");
     }
     var_dump($scope_array);
     return $scope_array;
 }
示例#2
0
    if (isset($args['id'])) {
        $where['id'] = $args['id'];
    }
    $model = new roleModel();
    $result = $model->listView($where);
    return $res->write(json_encode($result));
});
$app->post('/addAccess/{id:[0-9]+}', function ($req, $res, $args) {
    if ($req->getParsedBody()) {
        $data = $req->getParsedBody();
        $model = new roleModel();
        $result = $model->addAccess($args['id'], $data);
        // echo $db->last_query();
        return $res->write(json_encode($result));
    } else {
        return $res->withStatus(403)->write("No Post data!");
    }
});
$app->delete('/rmAccess/{id:[0-9]+}', function ($req, $res, $args) {
    if ($req->getParsedBody()) {
        $data = $req->getParsedBody();
        $model = new roleModel();
        $result = $model->rmAccess($args['id'], $data);
        // echo $db->last_query();
        return $res->write(json_encode($result));
    } else {
        return $res->withStatus(403)->write("No Post data!");
    }
});
$app->post('/arrangeAccess/{id:[0-9]+}', function ($req, $res, $args) {
});