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:
@@ -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
|
||||
|
||||
@@ -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}`
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,6 +97,7 @@ const login = async (
|
||||
return {
|
||||
loggedIn: true,
|
||||
user: {
|
||||
id: user.id,
|
||||
username: user.username,
|
||||
displayName: user.displayName
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ export interface UserPayload {
|
||||
isActive?: boolean
|
||||
/**
|
||||
* User-specific auto-exec code
|
||||
* @example "<SAS code>"
|
||||
* @example ""
|
||||
*/
|
||||
autoExec?: string
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user