mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-09-14 10:52:34 +00:00
Notification toasts, nicer loading, add new user support
This commit is contained in:
@@ -134,24 +134,24 @@ export default {
|
||||
* @param {Object} user
|
||||
* @returns {Promise}
|
||||
*/
|
||||
getTokenFromUser: (user) => {
|
||||
getTokenFromUser: async (user) => {
|
||||
const expire = "1d";
|
||||
const Token = new TokenModel();
|
||||
const expiry = parseDatePeriod(expire);
|
||||
|
||||
return Token.create({
|
||||
const signed = await Token.create({
|
||||
iss: "api",
|
||||
attrs: {
|
||||
id: user.id,
|
||||
},
|
||||
scope: ["user"],
|
||||
expiresIn: expire,
|
||||
}).then((signed) => {
|
||||
return {
|
||||
token: signed.token,
|
||||
expires: expiry.toISOString(),
|
||||
user: user,
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
token: signed.token,
|
||||
expires: expiry.toISOString(),
|
||||
user: user,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
@@ -337,11 +337,11 @@ const internalUser = {
|
||||
* @param {Integer} [id_requested]
|
||||
* @returns {[String]}
|
||||
*/
|
||||
getUserOmisionsByAccess: (access, id_requested) => {
|
||||
getUserOmisionsByAccess: (access, idRequested) => {
|
||||
let response = []; // Admin response
|
||||
|
||||
if (!access.token.hasScope("admin") && access.token.getUserId(0) !== id_requested) {
|
||||
response = ["roles", "is_deleted"]; // Restricted response
|
||||
if (!access.token.hasScope("admin") && access.token.getUserId(0) !== idRequested) {
|
||||
response = ["is_deleted"]; // Restricted response
|
||||
}
|
||||
|
||||
return response;
|
||||
|
@@ -123,16 +123,16 @@ export default () => {
|
||||
},
|
||||
|
||||
/**
|
||||
* @param [default_value]
|
||||
* @param [defaultValue]
|
||||
* @returns {Integer}
|
||||
*/
|
||||
getUserId: (default_value) => {
|
||||
getUserId: (defaultValue) => {
|
||||
const attrs = self.get("attrs");
|
||||
if (attrs && typeof attrs.id !== "undefined" && attrs.id) {
|
||||
return attrs.id;
|
||||
}
|
||||
|
||||
return default_value || 0;
|
||||
return defaultValue || 0;
|
||||
},
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user