dotnet-user
This commit is contained in:
parent
41b5be3056
commit
0afa53889d
1 changed files with 30 additions and 3 deletions
|
|
@ -208,6 +208,33 @@ export class PermissionController extends Controller {
|
|||
return new HttpSuccess(res);
|
||||
}
|
||||
|
||||
/**
|
||||
* API permission (dotnet api)
|
||||
* @summary permission (dotnet api)
|
||||
* @param {string} action action
|
||||
* @param {string} system authSysId
|
||||
* @param {string} profileId profileId
|
||||
*/
|
||||
@Get("dotnet-user/{action}/{system}/{profileId}")
|
||||
public async dotnetUser(
|
||||
@Request() req: RequestWithUser,
|
||||
@Path() action: string,
|
||||
@Path() system: string,
|
||||
@Path() profileId: string,
|
||||
) {
|
||||
if (!["CREATE", "DELETE", "GET", "LIST", "UPDATE"].includes(action)) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Action ไม่ถูกต้อง");
|
||||
}
|
||||
|
||||
let res = await new permission().PermissionOrgByUser(
|
||||
req,
|
||||
system.toLocaleUpperCase(),
|
||||
action,
|
||||
profileId,
|
||||
);
|
||||
return new HttpSuccess(res);
|
||||
}
|
||||
|
||||
@Get("org")
|
||||
public async listAuthSysOrg(@Request() request: RequestWithUser) {
|
||||
const redisClient = await this.redis.createClient({
|
||||
|
|
@ -217,7 +244,7 @@ export class PermissionController extends Controller {
|
|||
const getAsync = promisify(redisClient.get).bind(redisClient);
|
||||
|
||||
const profile = await this.profileRepo.findOne({
|
||||
select: ["id"],
|
||||
select: ["id"],
|
||||
where: { keycloak: request.user.sub },
|
||||
});
|
||||
if (!profile) {
|
||||
|
|
@ -254,7 +281,7 @@ export class PermissionController extends Controller {
|
|||
}
|
||||
|
||||
@Get("user/{id}")
|
||||
public async listOrgUser(@Request() request: RequestWithUser,@Path() id: string) {
|
||||
public async listOrgUser(@Request() request: RequestWithUser, @Path() id: string) {
|
||||
const redisClient = await this.redis.createClient({
|
||||
host: REDIS_HOST,
|
||||
port: REDIS_PORT,
|
||||
|
|
@ -262,7 +289,7 @@ export class PermissionController extends Controller {
|
|||
const getAsync = promisify(redisClient.get).bind(redisClient);
|
||||
|
||||
const profile = await this.profileRepo.findOne({
|
||||
select: ["id"],
|
||||
select: ["id"],
|
||||
where: { id: id },
|
||||
});
|
||||
if (!profile) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue