@codefresh-io/authenticated-entity
Advanced tools
Comparing version 2.0.6 to 2.0.7
@@ -28,2 +28,3 @@ 'use strict'; | ||
admins: ['fake-user-id-2', 'fake-user-id-1'], | ||
plan: 'fake-account-plan-1', | ||
teams: ['fake-team-id-2', 'fake-team-id-1'] | ||
@@ -36,2 +37,3 @@ }, | ||
admins: ['fake-user-id-2', 'fake-user-id-3'], | ||
plan: 'fake-account-plan-2', | ||
teams: ['fake-team-id-3', 'fake-team-id-4'] | ||
@@ -42,4 +44,4 @@ } | ||
} | ||
const encodedFakeUser = 'eyJ0eXBlIjoidXNlciIsIm5hbWUiOiJmYWtlLXVzZXJOYW1lIiwiX2lkIjoiZmFrZS11c2VyLWlkLTEiLCJhY2NvdW50cyI6W3sibmFtZSI6ImZha2UtYWNjb3VudC1uYW1lLTEiLCJfaWQiOiJmYWtlLWFjY291bnRJZC0xIiwiaXNBZG1pbiI6dHJ1ZSwiYWRtaW5UZWFtIjoiMTIzNCIsInRlYW1zIjpbImZha2UtdGVhbS1pZC0yIiwiZmFrZS10ZWFtLWlkLTEiXX0seyJuYW1lIjoiZmFrZS1hY2NvdW50LW5hbWUtMiIsIl9pZCI6ImZha2UtYWNjb3VudElkLTIiLCJpc0FkbWluIjpmYWxzZSwiYWRtaW5UZWFtIjoiMTIzNDUiLCJ0ZWFtcyI6WyJmYWtlLXRlYW0taWQtMyIsImZha2UtdGVhbS1pZC00Il19XX0='; | ||
const generatedHasFakeUser = '4e35025e52e2b81d4de55ddb761eb90e2fdd72a1a00525db83e4b2ae316d0310'; | ||
const encodedFakeUser = 'eyJ0eXBlIjoidXNlciIsIm5hbWUiOiJmYWtlLXVzZXJOYW1lIiwiX2lkIjoiZmFrZS11c2VyLWlkLTEiLCJhY2NvdW50cyI6W3sibmFtZSI6ImZha2UtYWNjb3VudC1uYW1lLTEiLCJfaWQiOiJmYWtlLWFjY291bnRJZC0xIiwiaXNBZG1pbiI6dHJ1ZSwiYWRtaW5UZWFtIjoiMTIzNCIsInRlYW1zIjpbImZha2UtdGVhbS1pZC0yIiwiZmFrZS10ZWFtLWlkLTEiXSwicGxhbiI6ImZha2UtYWNjb3VudC1wbGFuLTEifSx7Im5hbWUiOiJmYWtlLWFjY291bnQtbmFtZS0yIiwiX2lkIjoiZmFrZS1hY2NvdW50SWQtMiIsImlzQWRtaW4iOmZhbHNlLCJhZG1pblRlYW0iOiIxMjM0NSIsInRlYW1zIjpbImZha2UtdGVhbS1pZC0zIiwiZmFrZS10ZWFtLWlkLTQiXSwicGxhbiI6ImZha2UtYWNjb3VudC1wbGFuLTIifV19'; | ||
const generatedHasFakeUser = 'f0ae6683c6a98b04120287ea17d456b78493bd2ca5760412548c78697c1afc63'; | ||
@@ -55,2 +57,3 @@ const jsonValidUser = { | ||
'adminTeam': '1234', | ||
'plan': 'fake-account-plan-1', | ||
'teams': ['fake-team-id-2', 'fake-team-id-1'] | ||
@@ -63,2 +66,3 @@ }, | ||
'name': 'fake-account-name-2', | ||
'plan': 'fake-account-plan-2', | ||
'teams': ['fake-team-id-3', 'fake-team-id-4'] | ||
@@ -144,2 +148,3 @@ } | ||
'name': 'fake-account-name-1', | ||
'plan': 'fake-account-plan-1', | ||
'teams': ['fake-team-id-2', 'fake-team-id-1'] | ||
@@ -162,2 +167,3 @@ }); | ||
'name': 'fake-account-name-1', | ||
'plan': 'fake-account-plan-1', | ||
'teams': ['fake-team-id-2', 'fake-team-id-1'] | ||
@@ -209,3 +215,3 @@ }); | ||
expect((User.constructFromUserEntity(fakeUserData())).toString()) | ||
.to.be.equal(`{"type":"user","name":"fake-userName","_id":"fake-user-id-1","accounts":[{"name":"fake-account-name-1","_id":"fake-accountId-1","isAdmin":true,"adminTeam":"1234","teams":["fake-team-id-2","fake-team-id-1"]},{"name":"fake-account-name-2","_id":"fake-accountId-2","isAdmin":false,"adminTeam":"12345","teams":["fake-team-id-3","fake-team-id-4"]}]}`); | ||
.to.be.equal(`{"type":"user","name":"fake-userName","_id":"fake-user-id-1","accounts":[{"name":"fake-account-name-1","_id":"fake-accountId-1","isAdmin":true,"adminTeam":"1234","teams":["fake-team-id-2","fake-team-id-1"],"plan":"fake-account-plan-1"},{"name":"fake-account-name-2","_id":"fake-accountId-2","isAdmin":false,"adminTeam":"12345","teams":["fake-team-id-3","fake-team-id-4"],"plan":"fake-account-plan-2"}]}`); | ||
}); | ||
@@ -212,0 +218,0 @@ |
@@ -46,3 +46,4 @@ const _ = require('lodash'); | ||
adminTeam: account.adminTeam, | ||
teams: account.teams || [] | ||
teams: account.teams || [], | ||
plan: account.plan, | ||
}; | ||
@@ -100,2 +101,10 @@ }) | ||
} | ||
getPlanByAccountName(name) { | ||
const account = this.getAccountByName(name); | ||
let plan; | ||
if (account) { | ||
plan = account.plan; | ||
} | ||
return plan; | ||
} | ||
getUserId() { | ||
@@ -102,0 +111,0 @@ return this._entity._id; |
{ | ||
"name": "@codefresh-io/authenticated-entity", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
235305
664
0