|
@@ -152,7 +152,7 @@ module.exports = (crowi) => {
|
|
|
* type: object
|
|
* type: object
|
|
|
* description: personal params
|
|
* description: personal params
|
|
|
*/
|
|
*/
|
|
|
- router.get('/', accessTokenParser([SCOPE.READ.USER.INFO]), loginRequiredStrictly, async(req, res) => {
|
|
|
|
|
|
|
+ router.get('/', accessTokenParser([SCOPE.READ.USER_SETTINGS.INFO]), loginRequiredStrictly, async(req, res) => {
|
|
|
const { username } = req.user;
|
|
const { username } = req.user;
|
|
|
try {
|
|
try {
|
|
|
const user = await User.findUserByUsername(username);
|
|
const user = await User.findUserByUsername(username);
|
|
@@ -190,7 +190,7 @@ module.exports = (crowi) => {
|
|
|
* isPasswordSet:
|
|
* isPasswordSet:
|
|
|
* type: boolean
|
|
* type: boolean
|
|
|
*/
|
|
*/
|
|
|
- router.get('/is-password-set', accessTokenParser([SCOPE.READ.USER.PASSWORD]), loginRequiredStrictly, async(req, res) => {
|
|
|
|
|
|
|
+ router.get('/is-password-set', accessTokenParser([SCOPE.READ.USER_SETTINGS.PASSWORD]), loginRequiredStrictly, async(req, res) => {
|
|
|
const { username } = req.user;
|
|
const { username } = req.user;
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -232,7 +232,7 @@ module.exports = (crowi) => {
|
|
|
* type: object
|
|
* type: object
|
|
|
* description: personal params
|
|
* description: personal params
|
|
|
*/
|
|
*/
|
|
|
- router.put('/', accessTokenParser([SCOPE.WRITE.USER.INFO]), loginRequiredStrictly, addActivity, validator.personal, apiV3FormValidator, async(req, res) => {
|
|
|
|
|
|
|
+ router.put('/', accessTokenParser([SCOPE.WRITE.USER_SETTINGS.INFO]), loginRequiredStrictly, addActivity, validator.personal, apiV3FormValidator, async(req, res) => {
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
const user = await User.findOne({ _id: req.user.id });
|
|
const user = await User.findOne({ _id: req.user.id });
|
|
@@ -283,7 +283,7 @@ module.exports = (crowi) => {
|
|
|
* type: object
|
|
* type: object
|
|
|
* description: user data
|
|
* description: user data
|
|
|
*/
|
|
*/
|
|
|
- router.put('/image-type', accessTokenParser([SCOPE.WRITE.USER.INFO]), loginRequiredStrictly, addActivity,
|
|
|
|
|
|
|
+ router.put('/image-type', accessTokenParser([SCOPE.WRITE.USER_SETTINGS.INFO]), loginRequiredStrictly, addActivity,
|
|
|
validator.imageType, apiV3FormValidator,
|
|
validator.imageType, apiV3FormValidator,
|
|
|
async(req, res) => {
|
|
async(req, res) => {
|
|
|
const { isGravatarEnabled } = req.body;
|
|
const { isGravatarEnabled } = req.body;
|
|
@@ -322,7 +322,7 @@ module.exports = (crowi) => {
|
|
|
* type: object
|
|
* type: object
|
|
|
* description: array of external accounts
|
|
* description: array of external accounts
|
|
|
*/
|
|
*/
|
|
|
- router.get('/external-accounts', accessTokenParser([SCOPE.READ.USER.EXTERNAL_ACCOUNT]), loginRequiredStrictly, async(req, res) => {
|
|
|
|
|
|
|
+ router.get('/external-accounts', accessTokenParser([SCOPE.READ.USER_SETTINGS.EXTERNAL_ACCOUNT]), loginRequiredStrictly, async(req, res) => {
|
|
|
const userData = req.user;
|
|
const userData = req.user;
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -362,7 +362,7 @@ module.exports = (crowi) => {
|
|
|
* type: object
|
|
* type: object
|
|
|
* description: user data updated
|
|
* description: user data updated
|
|
|
*/
|
|
*/
|
|
|
- router.put('/password', accessTokenParser([SCOPE.WRITE.USER.PASSWORD]), loginRequiredStrictly, addActivity, validator.password, apiV3FormValidator,
|
|
|
|
|
|
|
+ router.put('/password', accessTokenParser([SCOPE.WRITE.USER_SETTINGS.PASSWORD]), loginRequiredStrictly, addActivity, validator.password, apiV3FormValidator,
|
|
|
async(req, res) => {
|
|
async(req, res) => {
|
|
|
const { body, user } = req;
|
|
const { body, user } = req;
|
|
|
const { oldPassword, newPassword } = body;
|
|
const { oldPassword, newPassword } = body;
|
|
@@ -405,7 +405,7 @@ module.exports = (crowi) => {
|
|
|
* type: object
|
|
* type: object
|
|
|
* description: user data
|
|
* description: user data
|
|
|
*/
|
|
*/
|
|
|
- router.put('/api-token', accessTokenParser([SCOPE.WRITE.USER.API.API_TOKEN]), loginRequiredStrictly, addActivity, async(req, res) => {
|
|
|
|
|
|
|
+ router.put('/api-token', accessTokenParser([SCOPE.WRITE.USER_SETTINGS.API.API_TOKEN]), loginRequiredStrictly, addActivity, async(req, res) => {
|
|
|
const { user } = req;
|
|
const { user } = req;
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -442,7 +442,7 @@ module.exports = (crowi) => {
|
|
|
* type: objet
|
|
* type: objet
|
|
|
* description: array of access tokens
|
|
* description: array of access tokens
|
|
|
*/
|
|
*/
|
|
|
- router.get('/access-token', accessTokenParser([SCOPE.READ.USER.API.ACCESS_TOKEN]), getAccessTokenHandlerFactory(crowi));
|
|
|
|
|
|
|
+ router.get('/access-token', accessTokenParser([SCOPE.READ.USER_SETTINGS.API.ACCESS_TOKEN]), getAccessTokenHandlerFactory(crowi));
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @swagger
|
|
* @swagger
|
|
@@ -475,7 +475,7 @@ module.exports = (crowi) => {
|
|
|
* type: string[]
|
|
* type: string[]
|
|
|
* description: scope of access token
|
|
* description: scope of access token
|
|
|
*/
|
|
*/
|
|
|
- router.post('/access-token', accessTokenParser([SCOPE.WRITE.USER.API.ACCESS_TOKEN]), generateAccessTokenHandlerFactory(crowi));
|
|
|
|
|
|
|
+ router.post('/access-token', accessTokenParser([SCOPE.WRITE.USER_SETTINGS.API.ACCESS_TOKEN]), generateAccessTokenHandlerFactory(crowi));
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @swagger
|
|
* @swagger
|
|
@@ -490,7 +490,7 @@ module.exports = (crowi) => {
|
|
|
* description: succeded to delete access token
|
|
* description: succeded to delete access token
|
|
|
*
|
|
*
|
|
|
*/
|
|
*/
|
|
|
- router.delete('/access-token', accessTokenParser([SCOPE.WRITE.USER.API.ACCESS_TOKEN]), deleteAccessTokenHandlersFactory(crowi));
|
|
|
|
|
|
|
+ router.delete('/access-token', accessTokenParser([SCOPE.WRITE.USER_SETTINGS.API.ACCESS_TOKEN]), deleteAccessTokenHandlersFactory(crowi));
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @swagger
|
|
* @swagger
|
|
@@ -504,7 +504,7 @@ module.exports = (crowi) => {
|
|
|
* 200:
|
|
* 200:
|
|
|
* description: succeded to delete all access tokens
|
|
* description: succeded to delete all access tokens
|
|
|
*/
|
|
*/
|
|
|
- router.delete('/access-token/all', accessTokenParser([SCOPE.WRITE.USER.API.ACCESS_TOKEN]), deleteAllAccessTokensHandlersFactory(crowi));
|
|
|
|
|
|
|
+ router.delete('/access-token/all', accessTokenParser([SCOPE.WRITE.USER_SETTINGS.API.ACCESS_TOKEN]), deleteAllAccessTokensHandlersFactory(crowi));
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @swagger
|
|
* @swagger
|
|
@@ -532,7 +532,7 @@ module.exports = (crowi) => {
|
|
|
* type: object
|
|
* type: object
|
|
|
* description: Ldap account associate to me
|
|
* description: Ldap account associate to me
|
|
|
*/
|
|
*/
|
|
|
- router.put('/associate-ldap', accessTokenParser([SCOPE.WRITE.USER.EXTERNAL_ACCOUNT]), loginRequiredStrictly, addActivity,
|
|
|
|
|
|
|
+ router.put('/associate-ldap', accessTokenParser([SCOPE.WRITE.USER_SETTINGS.EXTERNAL_ACCOUNT]), loginRequiredStrictly, addActivity,
|
|
|
validator.associateLdap, apiV3FormValidator,
|
|
validator.associateLdap, apiV3FormValidator,
|
|
|
async(req, res) => {
|
|
async(req, res) => {
|
|
|
const { passportService } = crowi;
|
|
const { passportService } = crowi;
|
|
@@ -587,7 +587,7 @@ module.exports = (crowi) => {
|
|
|
* description: Ldap account disassociate to me
|
|
* description: Ldap account disassociate to me
|
|
|
*/
|
|
*/
|
|
|
// eslint-disable-next-line max-len
|
|
// eslint-disable-next-line max-len
|
|
|
- router.put('/disassociate-ldap', accessTokenParser([SCOPE.WRITE.USER.EXTERNAL_ACCOUNT]), loginRequiredStrictly, addActivity, validator.disassociateLdap, apiV3FormValidator,
|
|
|
|
|
|
|
+ router.put('/disassociate-ldap', accessTokenParser([SCOPE.WRITE.USER_SETTINGS.EXTERNAL_ACCOUNT]), loginRequiredStrictly, addActivity, validator.disassociateLdap, apiV3FormValidator,
|
|
|
async(req, res) => {
|
|
async(req, res) => {
|
|
|
const { user, body } = req;
|
|
const { user, body } = req;
|
|
|
const { providerType, accountId } = body;
|
|
const { providerType, accountId } = body;
|
|
@@ -632,7 +632,7 @@ module.exports = (crowi) => {
|
|
|
* type: object
|
|
* type: object
|
|
|
* description: editor settings
|
|
* description: editor settings
|
|
|
*/
|
|
*/
|
|
|
- router.put('/editor-settings', accessTokenParser([SCOPE.WRITE.USER.OTHER]), loginRequiredStrictly, addActivity, validator.editorSettings, apiV3FormValidator,
|
|
|
|
|
|
|
+ router.put('/editor-settings', accessTokenParser([SCOPE.WRITE.USER_SETTINGS.OTHER]), loginRequiredStrictly, addActivity, validator.editorSettings, apiV3FormValidator,
|
|
|
async(req, res) => {
|
|
async(req, res) => {
|
|
|
const query = { userId: req.user.id };
|
|
const query = { userId: req.user.id };
|
|
|
const { body } = req;
|
|
const { body } = req;
|
|
@@ -683,7 +683,7 @@ module.exports = (crowi) => {
|
|
|
* type: object
|
|
* type: object
|
|
|
* description: editor settings
|
|
* description: editor settings
|
|
|
*/
|
|
*/
|
|
|
- router.get('/editor-settings', accessTokenParser([SCOPE.READ.USER.OTHER]), loginRequiredStrictly, async(req, res) => {
|
|
|
|
|
|
|
+ router.get('/editor-settings', accessTokenParser([SCOPE.READ.USER_SETTINGS.OTHER]), loginRequiredStrictly, async(req, res) => {
|
|
|
try {
|
|
try {
|
|
|
const query = { userId: req.user.id };
|
|
const query = { userId: req.user.id };
|
|
|
const editorSettings = await EditorSettings.findOne(query) ?? new EditorSettings();
|
|
const editorSettings = await EditorSettings.findOne(query) ?? new EditorSettings();
|
|
@@ -716,7 +716,7 @@ module.exports = (crowi) => {
|
|
|
* description: in-app-notification-settings
|
|
* description: in-app-notification-settings
|
|
|
*/
|
|
*/
|
|
|
// eslint-disable-next-line max-len
|
|
// eslint-disable-next-line max-len
|
|
|
- router.put('/in-app-notification-settings', accessTokenParser([SCOPE.WRITE.USER.IN_APP_NOTIFICATION]), loginRequiredStrictly, addActivity, validator.inAppNotificationSettings, apiV3FormValidator, async(req, res) => {
|
|
|
|
|
|
|
+ router.put('/in-app-notification-settings', accessTokenParser([SCOPE.WRITE.USER_SETTINGS.IN_APP_NOTIFICATION]), loginRequiredStrictly, addActivity, validator.inAppNotificationSettings, apiV3FormValidator, async(req, res) => {
|
|
|
const query = { userId: req.user.id };
|
|
const query = { userId: req.user.id };
|
|
|
const subscribeRules = req.body.subscribeRules;
|
|
const subscribeRules = req.body.subscribeRules;
|
|
|
|
|
|
|
@@ -759,7 +759,7 @@ module.exports = (crowi) => {
|
|
|
* type: object
|
|
* type: object
|
|
|
* description: InAppNotificationSettings
|
|
* description: InAppNotificationSettings
|
|
|
*/
|
|
*/
|
|
|
- router.get('/in-app-notification-settings', accessTokenParser([SCOPE.READ.USER.IN_APP_NOTIFICATION]), loginRequiredStrictly, async(req, res) => {
|
|
|
|
|
|
|
+ router.get('/in-app-notification-settings', accessTokenParser([SCOPE.READ.USER_SETTINGS.IN_APP_NOTIFICATION]), loginRequiredStrictly, async(req, res) => {
|
|
|
const query = { userId: req.user.id };
|
|
const query = { userId: req.user.id };
|
|
|
try {
|
|
try {
|
|
|
const response = await InAppNotificationSettings.findOne(query);
|
|
const response = await InAppNotificationSettings.findOne(query);
|
|
@@ -772,7 +772,7 @@ module.exports = (crowi) => {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// eslint-disable-next-line max-len
|
|
// eslint-disable-next-line max-len
|
|
|
- router.put('/questionnaire-settings', accessTokenParser([SCOPE.WRITE.BASE.QUESTIONNAIRE]), loginRequiredStrictly, validator.questionnaireSettings, apiV3FormValidator, async(req, res) => {
|
|
|
|
|
|
|
+ router.put('/questionnaire-settings', accessTokenParser([SCOPE.WRITE.FEATURES.QUESTIONNAIRE]), loginRequiredStrictly, validator.questionnaireSettings, apiV3FormValidator, async(req, res) => {
|
|
|
const { isQuestionnaireEnabled } = req.body;
|
|
const { isQuestionnaireEnabled } = req.body;
|
|
|
const { user } = req;
|
|
const { user } = req;
|
|
|
try {
|
|
try {
|