mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-02-17 23:45:29 -05:00
fix logging in utils/allow_action (#3147)
This commit is contained in:
parent
f8a7fc94a8
commit
e9d1e82666
1 changed files with 3 additions and 3 deletions
|
@ -188,17 +188,17 @@ export function allow_action(action: ActionsAllowed, logger): AllowAction {
|
|||
pkg: AuthPackageAllow,
|
||||
callback: AllowActionCallback
|
||||
): void {
|
||||
logger.trace({ remote: user.name }, `[auth/allow_action]: user: @{user.name}`);
|
||||
logger.trace({ remote: user.name }, `[auth/allow_action]: user: @{remote}`);
|
||||
const { name, groups } = user;
|
||||
const groupAccess = pkg[action] as string[];
|
||||
const hasPermission = groupAccess.some((group) => name === group || groups.includes(group));
|
||||
logger.trace(
|
||||
{ pkgName: pkg.name, hasPermission, remote: user.name, groupAccess },
|
||||
`[auth/allow_action]: hasPermission? @{hasPermission} for user: @{user}`
|
||||
`[auth/allow_action]: hasPermission? @{hasPermission} for user: @{remote}, package: @{pkgName}`
|
||||
);
|
||||
|
||||
if (hasPermission) {
|
||||
logger.trace({ remote: user.name }, `auth/allow_action: access granted to: @{user}`);
|
||||
logger.trace({ remote: user.name }, `auth/allow_action: access granted to: @{remote}`);
|
||||
return callback(null, true);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue