1
0
mirror of https://github.com/sasjs/server.git synced 2025-12-11 03:34:35 +00:00

feat(web): added profile + edit + autoexec changes

This commit is contained in:
Saad Jutt
2022-05-26 04:25:15 +05:00
parent e4239fbcc3
commit c275db184e
13 changed files with 256 additions and 17 deletions

View File

@@ -357,7 +357,7 @@ components:
autoExec:
type: string
description: 'User-specific auto-exec code'
example: '<SAS code>'
example: ""
required:
- displayName
- username
@@ -543,7 +543,7 @@ paths:
application/json:
schema:
properties:
user: {properties: {displayName: {type: string}, username: {type: string}}, required: [displayName, username], type: object}
user: {properties: {displayName: {type: string}, username: {type: string}, id: {type: number, format: double}}, required: [displayName, username, id], type: object}
loggedIn: {type: boolean}
required:
- user

View File

@@ -119,9 +119,9 @@ filename _webout "${weboutPath}" mod;
/* dynamic user-provided vars */
${preProgramVarStatments}
/* user auto exec starts */
${otherArgs?.userAutoExec}
/* user auto exec ends */
/* user autoexec starts */
${otherArgs?.userAutoExec ?? ''}
/* user autoexec ends */
/* actual job code */
${program}`

View File

@@ -177,7 +177,7 @@ const getUser = async (
username: user.username,
isActive: user.isActive,
isAdmin: user.isAdmin,
autoExec: getAutoExec ? user.autoExec : undefined
autoExec: getAutoExec ? user.autoExec ?? '' : undefined
}
}

View File

@@ -97,6 +97,7 @@ const login = async (
return {
loggedIn: true,
user: {
id: user.id,
username: user.username,
displayName: user.displayName
}

View File

@@ -29,7 +29,7 @@ export interface UserPayload {
isActive?: boolean
/**
* User-specific auto-exec code
* @example "<SAS code>"
* @example ""
*/
autoExec?: string
}

View File

@@ -36,7 +36,7 @@ export const registerUserValidation = (data: any): Joi.ValidationResult =>
password: passwordSchema.required(),
isAdmin: Joi.boolean(),
isActive: Joi.boolean(),
autoExec: Joi.string()
autoExec: Joi.string().allow('')
}).validate(data)
export const deleteUserValidation = (
@@ -59,7 +59,7 @@ export const updateUserValidation = (
displayName: Joi.string().min(6),
username: usernameSchema,
password: passwordSchema,
autoExec: Joi.string()
autoExec: Joi.string().allow('')
}
if (isAdmin) {
validationChecks.isAdmin = Joi.boolean()