You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
788 B
36 lines
788 B
'use strict';
|
|
|
|
const firstText = (...values) => {
|
|
for (const value of values) {
|
|
const text = String(value ?? '').trim();
|
|
if (text) return text;
|
|
}
|
|
return '';
|
|
};
|
|
|
|
const resolveQuotaUserId = (ctx, explicitUserId = null) => {
|
|
const body = ctx?.request?.body || {};
|
|
const query = ctx?.request?.query || {};
|
|
const userInfo = ctx?.fs?.curUser?.userInfo || {};
|
|
|
|
return firstText(
|
|
userInfo.pepUserId,
|
|
userInfo.pep_user_id,
|
|
userInfo.pepId,
|
|
userInfo.pep_id,
|
|
ctx?.fs?.userIdMapping?.internalUserId,
|
|
explicitUserId,
|
|
body.creator,
|
|
body.userId,
|
|
body.userid,
|
|
query.creator,
|
|
query.userId,
|
|
query.userid,
|
|
userInfo.id,
|
|
userInfo.userId,
|
|
);
|
|
};
|
|
|
|
module.exports = {
|
|
resolveQuotaUserId,
|
|
};
|
|
|