bitwarden-estensione-browser/libs/common/src/models/domain/organization.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

220 lines
6.3 KiB
TypeScript
Raw Normal View History

[PS-1854] Split services between background and visualizations (#4075) * Elevate Map <-> Record JSON helpers to Utils * Build Account from a StateService provided AccountDeserializer * Allow Manifest V2 usage of session sync Expands use of SessionSyncer to all Subject types. Correctly handles replay buffer for each type to ignore the flood of data upon subscription to each Subject type. * Create browser-synced Policy Service * Move BrowserFolderService * Libs account serialization improvements * Serialize Browser Accounts * Separate StateService in background/visualizations Visualizer state services share storages with background page, which nicely emulates mv3 synchronization through session/local storage. There should not be multithreading issues since all of these services are still running through a single thread, we just now have multiple places we are reading/writing data from. Smaller improvements * Rename browser's state service to BrowserStateService * Remove unused WithPrototype decorator :celebrate: * Removed conversion on withPrototypeForArrayMembers. It's reasonable to think that if the type is maintained, it doesn't need conversion. Eventually, we should be able to remove the withPrototypeForArrayMembers decorator as well, but that will require a bit more work on (de)serialization of the Accounts.data property. * Make Record <-> Map idempotent Should we get in a situation where we _think_ an object has been jsonified, but hasn't been, we need to correctly deal with the object received to create our target. * Check all requirements while duck typing * Name client services after the client * Use union type to limit initialize options * Fixup usages of `initializeAs` * Add OrganizationService to synced services Co-Authored-By: Daniel James Smith <djsmith85@users.noreply.github.com> * Add Settings service to synced services Co-Authored-By: Daniel James Smith <djsmith85@users.noreply.github.com> * Add missing BrowserStateService * Fix factories to use browser-specific service overides * Fix org-service registration in services.module * Revert "Add missing BrowserStateService" This reverts commit 81cf384e872718e86e84f9c54731e78a083e1ee3. * Fix session syncer tests * Fix synced item metadata tests * Early return null json objects * Prefer abstract service dependencies * Prefer minimal browser service overrides * [SG-632] - Change forwarded providers radio buttons list to dropdown (#4045) * SG-632 - Changed forwarded providers list of radio buttons to dropdown * SG-632 - Added role attributes to improve accessibility. * SG-632 - Added sorting to array and empty option * SG-632 - Fix styling to match standards. * rename cipehrs component to vault items component (#4081) * Update the version hash for the QA Web build artifact to follow SemVer syntax (#4102) * Remove extra call to toJSON() (#4101) Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith@web.de> Co-authored-by: Carlos Gonçalves <carlosmaccam@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Joseph Flinn <58369717+joseph-flinn@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2022-11-23 23:26:57 +01:00
import { Jsonify } from "type-fest";
2018-05-18 21:26:46 +02:00
import { OrganizationUserStatusType } from "../../enums/organizationUserStatusType";
import { OrganizationUserType } from "../../enums/organizationUserType";
Feature/families for enterprise (#549) * Families for enterprise/account settings (#541) * Add node tests to pipeline (#525) * Add support for crypto agent (#520) * feat: add an importer for Safari (CSV) (#512) * feat(importers/safariCsvImporter): add the importer for Safari (CSV) * Revert changes to package-lock.json Co-authored-by: Thomas Rittson <trittson@bitwarden.com> * Dynamically set electron user agent (#524) * Dynamically set electron user agent * PR review * linter fixes * Test agent static version does not change * Fix formatting * Add role="alert" to callouts only when enforceAlert is passed (#528) * Add role="alert" to callouts when enforceAlert is passed * Remove ElementRef and do a different way * Rename input variable * Add PR template (#529) * Allow managers to create collections (#530) * Pass in null for sso organziation for now. (#531) This will bypass cryptoagent * Add Linked Field as custom field type (#431) * Basic proof of concept of Linked custom fields * Linked Fields for all cipher types, use dropdown * Move linkedFieldOptions to view models * Move add-edit custom fields to own component * Fix change handling if cipherType changes * Use Field.LinkedId to store linked field info * Refactor accessors in cipherView for type safety * Use map for linkedFieldOptions * Refactor: use decorators to record linkable info * Add ItemView * Use enums for linked field ids * Add union type for linkedId enums, add jsdoc comment * Use parameter properties for linkedFieldOption Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Fix type casting Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Update electron to 14.2.0 (#534) * Update electron to 14.1.1 * Update electron to 14.2.0 and fix it to this version * Removed ^ from electron in electron/package-lock.json * [Linked fields] Reset linkedIds if cipher type changes (#535) * Reset linkedIds if cipher type changes * Only reset linkedId if !editmode * Add call to server * Fix linting * Add call to server * Fix linting * Run linting * Add new properties to organization * Remove organizationUserId from request model * Added in org sponsorship calls * Sponsorship redeem existing org flow Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> * Revoke sponsorship uses organization id * Expect information in billing items on whether the item is sponsored * Families for enterprise/redeem card (#546) * Add userservice helper * Run linter * Add resend email to api service (#548) * Remove unneeded imports * Remove unneeded files * Add newline * Reorder import * Remove accidental newline * Fix lint issue Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-11-19 23:24:55 +01:00
import { ProductType } from "../../enums/productType";
import { PermissionsApi } from "../api/permissions.api";
import { OrganizationData } from "../data/organization.data";
2018-05-18 21:26:46 +02:00
export class Organization {
id: string;
name: string;
status: OrganizationUserStatusType;
type: OrganizationUserType;
enabled: boolean;
2020-01-15 21:25:06 +01:00
usePolicies: boolean;
useGroups: boolean;
useDirectory: boolean;
useEvents: boolean;
useTotp: boolean;
use2fa: boolean;
2019-03-02 18:22:51 +01:00
useApi: boolean;
useSso: boolean;
2021-11-17 11:42:24 +01:00
useKeyConnector: boolean;
useScim: boolean;
useCustomPermissions: boolean;
useResetPassword: boolean;
selfHost: boolean;
usersGetPremium: boolean;
seats: number;
maxCollections: number;
2018-07-18 15:21:34 +02:00
maxStorageGb?: number;
ssoBound: boolean;
identifier: string;
permissions: PermissionsApi;
resetPasswordEnrolled: boolean;
userId: string;
hasPublicAndPrivateKeys: boolean;
providerId: string;
providerName: string;
isProviderUser: boolean;
Feature/families for enterprise (#549) * Families for enterprise/account settings (#541) * Add node tests to pipeline (#525) * Add support for crypto agent (#520) * feat: add an importer for Safari (CSV) (#512) * feat(importers/safariCsvImporter): add the importer for Safari (CSV) * Revert changes to package-lock.json Co-authored-by: Thomas Rittson <trittson@bitwarden.com> * Dynamically set electron user agent (#524) * Dynamically set electron user agent * PR review * linter fixes * Test agent static version does not change * Fix formatting * Add role="alert" to callouts only when enforceAlert is passed (#528) * Add role="alert" to callouts when enforceAlert is passed * Remove ElementRef and do a different way * Rename input variable * Add PR template (#529) * Allow managers to create collections (#530) * Pass in null for sso organziation for now. (#531) This will bypass cryptoagent * Add Linked Field as custom field type (#431) * Basic proof of concept of Linked custom fields * Linked Fields for all cipher types, use dropdown * Move linkedFieldOptions to view models * Move add-edit custom fields to own component * Fix change handling if cipherType changes * Use Field.LinkedId to store linked field info * Refactor accessors in cipherView for type safety * Use map for linkedFieldOptions * Refactor: use decorators to record linkable info * Add ItemView * Use enums for linked field ids * Add union type for linkedId enums, add jsdoc comment * Use parameter properties for linkedFieldOption Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Fix type casting Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Update electron to 14.2.0 (#534) * Update electron to 14.1.1 * Update electron to 14.2.0 and fix it to this version * Removed ^ from electron in electron/package-lock.json * [Linked fields] Reset linkedIds if cipher type changes (#535) * Reset linkedIds if cipher type changes * Only reset linkedId if !editmode * Add call to server * Fix linting * Add call to server * Fix linting * Run linting * Add new properties to organization * Remove organizationUserId from request model * Added in org sponsorship calls * Sponsorship redeem existing org flow Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> * Revoke sponsorship uses organization id * Expect information in billing items on whether the item is sponsored * Families for enterprise/redeem card (#546) * Add userservice helper * Run linter * Add resend email to api service (#548) * Remove unneeded imports * Remove unneeded files * Add newline * Reorder import * Remove accidental newline * Fix lint issue Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-11-19 23:24:55 +01:00
familySponsorshipFriendlyName: string;
familySponsorshipAvailable: boolean;
planProductType: ProductType;
2021-11-17 11:42:24 +01:00
keyConnectorEnabled: boolean;
keyConnectorUrl: string;
Feature/self hosted families for enterprise (#800) * Billing Sync Api Keys / Free Bitwarden Families Page updates (#767) * Work on billing sync api key maintenance * Add sync status call * Work on sync status copy * Return actual model * Update api calls/models * Fix linting * Run linting * Add in notAllowedValueAsync.validator.ts (#774) * Add in notAllowedValueAsync.validator.ts * Fix lint error * Run prettier * [PS-248] Feature/manage billing sync connection (#770) * Define org connection request and responses * Add organization connection API CRUD * Linter fixes * Handle create vs update in component * PR feedback * Remove unused import * Linter fixes * Use self hosted endpoints for f4e (#779) * Use self hosted endpoints for f4e * Call the method * Chore/merge/self hosted families for enterprise (#778) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> * Chore/merge/self hosted families for enterprise (#796) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) * [EC-159] [BEEEP] Remove factory providers in Angular DI (#775) * Forwarded email alias generation (#772) * generate forwarded alias with SL and AD * added forwarded email to type list * add ApiService dep * ApiServiceAbstraction * use proper status codes * only generate on button press * reset username to `-` * reset username when forwarded * Authorization header for anonaddy * use proper anonaddy json path * firefox relay support * update description for firefox * log username generation errors * PS-302 Added DeviceId to the 2FA email request and set it when calling the endpoint that's needed to see if it's a 2FA email because of a new device (#782) * [EC-154] [BEEEP] Add token for localesDirectory (#783) * Add token for localesDirectory * Add token for SYSTEM_LANGUAGE * [PS-74] Fix user authentication state checks (#721) * Create authService.authStatus, refactor isLocked checks * Rename authStatus -> getAuthStatus * [CP-30] Added creditCardNumber pipe for viewing saved card numbers properly (#590) Co-authored-by: Hinton <oscar@oscarhinton.com> * Fix linting (#789) * fix default forwardedService property name (#788) * Stop clearing list on every reload (#784) * [EC-151] Hide Subscription/Billing information for Provider-managed organizations (#777) * add canManageBilling permission and hasProvider helper method * [feat] End User Vault Refresh (#790) * Move access logic to org model (#713) * [feature] Allow for top level groupings to be collapsed (#712) * [End User Vault Refresh] Refactor route permission checking (#727) * Update admin access logic * Centralize route permission handling * Add permission check for disabled orgs * [EndUserVaultRefresh] Add base routing guard (#732) * Add a base class for Angular routing guards * Update Guard naming convention * Bump node-forge to 1.2.1 (#722) * Remove Internet Explorer logic (#723) * Username generator (#734) * add support for username generation * remove unused Router * pr feedback * Bump electron and related dependencies (#736) * PS-91 make isMacAppStore return true/false (#735) * return false if undefined from isMacAppStore * PS-91 use strict equality instead of null coalescing Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> * [bug] Fix Safari CSV importer for URL and Notes (#730) * Fix import path for safari importer (#740) * Force updates to be silent (#739) * support for username gen website setting (#738) * Fix jslibModule forms (#742) * Add DatePipe provider to JslibModule (#741) * Feature/move to jest (#744) * Switch to jest * Fix jslib-angular package name * Make angular test project * Split up tests by jslib project * Remove obsolete node test script * Use legacy deps with jest-preset-angular * Move web tests to common * Remove build from pipeline This was only being used because we were not using ts runners. We are now, so build is unnecessary * Remove the VerifyMasterPasswordComponent from jslib module (#747) * Add ellipsis pipe to jslib module (#746) * add ellipsis pipe to jslib module * Add ellipsis pipe to exports * Add ColorPasswordCountPipe to JslibModule (#751) * Generator cleanup (#753) * type is null by default * rename generator component * remove showWebsiteOption * shorthand if check * EC-134 Fix api token refresh (#749) * Fix apikey token refresh * Refactor: use class for TokenRequestTwoFactor * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * [euvr] Separate Billing Payment/History APIs (#750) * [euvr] Separate Billing Payment/History APIs * Updated to new accounts billing API * Removed getUserBilling as it will become obsolete once merged * [end user vault refresh] Base Changes For Vault Filters (#737) * [dependency] Update icons * Avoid duplicate fullSync api calls (#716) * Tweak component library slightly (#715) * Check runtime name vs mangled name (#724) * Add Chromatic (#719) * Update SECURITY.md (#725) * Update SECURITY.md Add link to our HackerOne program for submitting potential security issues. * Revise language on SECURITY.md * Remove error Response type check (#731) * Remove error Response type check Minimization is impacting type checking in a non-consistent way. The previous type check works locally, but not from build artifacts :shrug:. We only set `captchaRequired` on our errors when we want a resubmit with captcha included, so we're safe keying off that * linter * [JslibModule] Add JslibModule (#733) * Add ellipsis pipe (#728) * add ellipsis pipe * run prettier * Account for ellipsis length in returned string * Fix complete words case * Fix another complete words issue * fix for if there are not spaces in long value * extract length check to beginning of method * condense if statements * remove log * [refactor] Add optional folders param to folderService.getAllNested() This will be used later for use cases where the vault filters service needs to build a list of nested folders that have been filtered by organization * [feature] Add organization filters This is an MVP implementation of the changes needed for the vault refresh. This includes collapsable top level groupings, and organization based filters that dynamically adjust folders and collections. * [refactor] Break down vault filter into several components These changes rename and rewrite the GroupingsComponent into a VaultFiltersModule. The module follows typical angular patterns for structure and purpose, and contain components for each filter type. The mostly communicate via Input and Output, and depend on a VaultFilterService for sending and recieving data from other parts of the product. * [bug] Add missing events for folder add/edit * [refactor] Dont directly change activeFilter in VaultFilterComponent * [refactor] Move DisplayMode to a dedicated file Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> * [CL-16 Component Library] Menu Dropdown (#761) * [bug] Add missing null check in vault filters (#769) * [bug] Add @Injectable to VaultFilterService (#781) * [fix] Ran prettier * [fix] Fix merge issue I used createUrlTree when merging guards because I knew that was the angular standard, didn't notice that redirect was a helper method from us * Remove BaseGuard (#791) Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> * [EC-192] Use ts-jest instead of deprecated ts-jest/utils (#792) * [SG-230] “All Items” and “Trash” missing from Organization Vault (#795) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> Co-authored-by: Justin Baur <admin@justinbaur.com> Co-authored-by: Justin Baur <136baur@gmail.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com>
2022-05-10 23:02:51 +02:00
familySponsorshipLastSyncDate?: Date;
familySponsorshipValidUntil?: Date;
familySponsorshipToDelete?: boolean;
2021-12-16 13:36:21 +01:00
2018-05-18 21:26:46 +02:00
constructor(obj?: OrganizationData) {
if (obj == null) {
return;
}
2021-12-16 13:36:21 +01:00
2018-05-18 21:26:46 +02:00
this.id = obj.id;
this.name = obj.name;
this.status = obj.status;
this.type = obj.type;
this.enabled = obj.enabled;
2020-01-15 21:25:06 +01:00
this.usePolicies = obj.usePolicies;
this.useGroups = obj.useGroups;
this.useDirectory = obj.useDirectory;
this.useEvents = obj.useEvents;
this.useTotp = obj.useTotp;
this.use2fa = obj.use2fa;
2019-03-02 18:22:51 +01:00
this.useApi = obj.useApi;
this.useSso = obj.useSso;
2021-11-17 11:42:24 +01:00
this.useKeyConnector = obj.useKeyConnector;
this.useScim = obj.useScim;
this.useCustomPermissions = obj.useCustomPermissions;
this.useResetPassword = obj.useResetPassword;
this.selfHost = obj.selfHost;
this.usersGetPremium = obj.usersGetPremium;
this.seats = obj.seats;
this.maxCollections = obj.maxCollections;
2018-07-18 15:21:34 +02:00
this.maxStorageGb = obj.maxStorageGb;
this.ssoBound = obj.ssoBound;
this.identifier = obj.identifier;
this.permissions = obj.permissions;
this.resetPasswordEnrolled = obj.resetPasswordEnrolled;
this.userId = obj.userId;
this.hasPublicAndPrivateKeys = obj.hasPublicAndPrivateKeys;
this.providerId = obj.providerId;
this.providerName = obj.providerName;
this.isProviderUser = obj.isProviderUser;
Feature/families for enterprise (#549) * Families for enterprise/account settings (#541) * Add node tests to pipeline (#525) * Add support for crypto agent (#520) * feat: add an importer for Safari (CSV) (#512) * feat(importers/safariCsvImporter): add the importer for Safari (CSV) * Revert changes to package-lock.json Co-authored-by: Thomas Rittson <trittson@bitwarden.com> * Dynamically set electron user agent (#524) * Dynamically set electron user agent * PR review * linter fixes * Test agent static version does not change * Fix formatting * Add role="alert" to callouts only when enforceAlert is passed (#528) * Add role="alert" to callouts when enforceAlert is passed * Remove ElementRef and do a different way * Rename input variable * Add PR template (#529) * Allow managers to create collections (#530) * Pass in null for sso organziation for now. (#531) This will bypass cryptoagent * Add Linked Field as custom field type (#431) * Basic proof of concept of Linked custom fields * Linked Fields for all cipher types, use dropdown * Move linkedFieldOptions to view models * Move add-edit custom fields to own component * Fix change handling if cipherType changes * Use Field.LinkedId to store linked field info * Refactor accessors in cipherView for type safety * Use map for linkedFieldOptions * Refactor: use decorators to record linkable info * Add ItemView * Use enums for linked field ids * Add union type for linkedId enums, add jsdoc comment * Use parameter properties for linkedFieldOption Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Fix type casting Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Update electron to 14.2.0 (#534) * Update electron to 14.1.1 * Update electron to 14.2.0 and fix it to this version * Removed ^ from electron in electron/package-lock.json * [Linked fields] Reset linkedIds if cipher type changes (#535) * Reset linkedIds if cipher type changes * Only reset linkedId if !editmode * Add call to server * Fix linting * Add call to server * Fix linting * Run linting * Add new properties to organization * Remove organizationUserId from request model * Added in org sponsorship calls * Sponsorship redeem existing org flow Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> * Revoke sponsorship uses organization id * Expect information in billing items on whether the item is sponsored * Families for enterprise/redeem card (#546) * Add userservice helper * Run linter * Add resend email to api service (#548) * Remove unneeded imports * Remove unneeded files * Add newline * Reorder import * Remove accidental newline * Fix lint issue Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: pan93412 <pan93412@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Robyn MacCallum <nickersthecat@gmail.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2021-11-19 23:24:55 +01:00
this.familySponsorshipFriendlyName = obj.familySponsorshipFriendlyName;
this.familySponsorshipAvailable = obj.familySponsorshipAvailable;
this.planProductType = obj.planProductType;
2021-11-17 11:42:24 +01:00
this.keyConnectorEnabled = obj.keyConnectorEnabled;
this.keyConnectorUrl = obj.keyConnectorUrl;
Feature/self hosted families for enterprise (#800) * Billing Sync Api Keys / Free Bitwarden Families Page updates (#767) * Work on billing sync api key maintenance * Add sync status call * Work on sync status copy * Return actual model * Update api calls/models * Fix linting * Run linting * Add in notAllowedValueAsync.validator.ts (#774) * Add in notAllowedValueAsync.validator.ts * Fix lint error * Run prettier * [PS-248] Feature/manage billing sync connection (#770) * Define org connection request and responses * Add organization connection API CRUD * Linter fixes * Handle create vs update in component * PR feedback * Remove unused import * Linter fixes * Use self hosted endpoints for f4e (#779) * Use self hosted endpoints for f4e * Call the method * Chore/merge/self hosted families for enterprise (#778) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> * Chore/merge/self hosted families for enterprise (#796) * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * Update introduction for CL (#729) * Add jsdoc comments for user verification, password reprompt, and appApiAction (#754) * Rename and add comments to clarify password reprompt classes * Add comment for appApiAction * copy default options (#764) * Update jest configs to remove roots (#766) * Remove support for alreadyEncrypted (#762) * Add tests for domain models (#768) * Fix language always defaulting to english (#765) * Rename Export DTOs (#763) * [BEEEP] Allow linking to ciphers (#760) * Remove userId from data models (#771) * Add reorganization notice (#776) * Add reorganization notice * [BEEEP] Add banner component (#759) * [EC-159] [BEEEP] Remove factory providers in Angular DI (#775) * Forwarded email alias generation (#772) * generate forwarded alias with SL and AD * added forwarded email to type list * add ApiService dep * ApiServiceAbstraction * use proper status codes * only generate on button press * reset username to `-` * reset username when forwarded * Authorization header for anonaddy * use proper anonaddy json path * firefox relay support * update description for firefox * log username generation errors * PS-302 Added DeviceId to the 2FA email request and set it when calling the endpoint that's needed to see if it's a 2FA email because of a new device (#782) * [EC-154] [BEEEP] Add token for localesDirectory (#783) * Add token for localesDirectory * Add token for SYSTEM_LANGUAGE * [PS-74] Fix user authentication state checks (#721) * Create authService.authStatus, refactor isLocked checks * Rename authStatus -> getAuthStatus * [CP-30] Added creditCardNumber pipe for viewing saved card numbers properly (#590) Co-authored-by: Hinton <oscar@oscarhinton.com> * Fix linting (#789) * fix default forwardedService property name (#788) * Stop clearing list on every reload (#784) * [EC-151] Hide Subscription/Billing information for Provider-managed organizations (#777) * add canManageBilling permission and hasProvider helper method * [feat] End User Vault Refresh (#790) * Move access logic to org model (#713) * [feature] Allow for top level groupings to be collapsed (#712) * [End User Vault Refresh] Refactor route permission checking (#727) * Update admin access logic * Centralize route permission handling * Add permission check for disabled orgs * [EndUserVaultRefresh] Add base routing guard (#732) * Add a base class for Angular routing guards * Update Guard naming convention * Bump node-forge to 1.2.1 (#722) * Remove Internet Explorer logic (#723) * Username generator (#734) * add support for username generation * remove unused Router * pr feedback * Bump electron and related dependencies (#736) * PS-91 make isMacAppStore return true/false (#735) * return false if undefined from isMacAppStore * PS-91 use strict equality instead of null coalescing Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> * [bug] Fix Safari CSV importer for URL and Notes (#730) * Fix import path for safari importer (#740) * Force updates to be silent (#739) * support for username gen website setting (#738) * Fix jslibModule forms (#742) * Add DatePipe provider to JslibModule (#741) * Feature/move to jest (#744) * Switch to jest * Fix jslib-angular package name * Make angular test project * Split up tests by jslib project * Remove obsolete node test script * Use legacy deps with jest-preset-angular * Move web tests to common * Remove build from pipeline This was only being used because we were not using ts runners. We are now, so build is unnecessary * Remove the VerifyMasterPasswordComponent from jslib module (#747) * Add ellipsis pipe to jslib module (#746) * add ellipsis pipe to jslib module * Add ellipsis pipe to exports * Add ColorPasswordCountPipe to JslibModule (#751) * Generator cleanup (#753) * type is null by default * rename generator component * remove showWebsiteOption * shorthand if check * EC-134 Fix api token refresh (#749) * Fix apikey token refresh * Refactor: use class for TokenRequestTwoFactor * Remove keytar and biometric logic (#706) * [bug] CL - fix default button display and callout header class (#756) * [EC-142] Fix error during import of 1pux containing new email field format (#758) * Add support for complex email field type * Ensure complex email field type gets imported on identities * [euvr] Separate Billing Payment/History APIs (#750) * [euvr] Separate Billing Payment/History APIs * Updated to new accounts billing API * Removed getUserBilling as it will become obsolete once merged * [end user vault refresh] Base Changes For Vault Filters (#737) * [dependency] Update icons * Avoid duplicate fullSync api calls (#716) * Tweak component library slightly (#715) * Check runtime name vs mangled name (#724) * Add Chromatic (#719) * Update SECURITY.md (#725) * Update SECURITY.md Add link to our HackerOne program for submitting potential security issues. * Revise language on SECURITY.md * Remove error Response type check (#731) * Remove error Response type check Minimization is impacting type checking in a non-consistent way. The previous type check works locally, but not from build artifacts :shrug:. We only set `captchaRequired` on our errors when we want a resubmit with captcha included, so we're safe keying off that * linter * [JslibModule] Add JslibModule (#733) * Add ellipsis pipe (#728) * add ellipsis pipe * run prettier * Account for ellipsis length in returned string * Fix complete words case * Fix another complete words issue * fix for if there are not spaces in long value * extract length check to beginning of method * condense if statements * remove log * [refactor] Add optional folders param to folderService.getAllNested() This will be used later for use cases where the vault filters service needs to build a list of nested folders that have been filtered by organization * [feature] Add organization filters This is an MVP implementation of the changes needed for the vault refresh. This includes collapsable top level groupings, and organization based filters that dynamically adjust folders and collections. * [refactor] Break down vault filter into several components These changes rename and rewrite the GroupingsComponent into a VaultFiltersModule. The module follows typical angular patterns for structure and purpose, and contain components for each filter type. The mostly communicate via Input and Output, and depend on a VaultFilterService for sending and recieving data from other parts of the product. * [bug] Add missing events for folder add/edit * [refactor] Dont directly change activeFilter in VaultFilterComponent * [refactor] Move DisplayMode to a dedicated file Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> * [CL-16 Component Library] Menu Dropdown (#761) * [bug] Add missing null check in vault filters (#769) * [bug] Add @Injectable to VaultFilterService (#781) * [fix] Ran prettier * [fix] Fix merge issue I used createUrlTree when merging guards because I knew that was the angular standard, didn't notice that redirect was a helper method from us * Remove BaseGuard (#791) Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> * [EC-192] Use ts-jest instead of deprecated ts-jest/utils (#792) * [SG-230] “All Items” and “Trash” missing from Organization Vault (#795) Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com> Co-authored-by: Justin Baur <admin@justinbaur.com> Co-authored-by: Justin Baur <136baur@gmail.com> Co-authored-by: Oscar Hinton <oscar@oscarhinton.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com> Co-authored-by: Federico Maccaroni <fedemkr@gmail.com> Co-authored-by: Anthony Garera <gareraanthony@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Addison Beck <addisonbeck1@gmail.com> Co-authored-by: Thomas Rittson <trittson@bitwarden.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com> Co-authored-by: David Frankel <42774874+frankeld@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com> Co-authored-by: Vincent Salucci <vincesalucci21@gmail.com>
2022-05-10 23:02:51 +02:00
this.familySponsorshipLastSyncDate = obj.familySponsorshipLastSyncDate;
this.familySponsorshipValidUntil = obj.familySponsorshipValidUntil;
this.familySponsorshipToDelete = obj.familySponsorshipToDelete;
2018-05-18 21:26:46 +02:00
}
2021-12-16 13:36:21 +01:00
2018-07-04 05:33:15 +02:00
get canAccess() {
if (this.type === OrganizationUserType.Owner) {
return true;
}
return this.enabled && this.status === OrganizationUserStatusType.Confirmed;
}
2021-12-16 13:36:21 +01:00
2018-10-17 16:51:09 +02:00
get isManager() {
return (
this.type === OrganizationUserType.Manager ||
this.type === OrganizationUserType.Owner ||
this.type === OrganizationUserType.Admin
);
}
2021-12-16 13:36:21 +01:00
2018-07-04 05:33:15 +02:00
get isAdmin() {
return this.type === OrganizationUserType.Owner || this.type === OrganizationUserType.Admin;
}
2021-12-16 13:36:21 +01:00
2018-07-17 21:56:49 +02:00
get isOwner() {
return this.type === OrganizationUserType.Owner || this.isProviderUser;
2018-07-17 21:56:49 +02:00
}
2021-12-16 13:36:21 +01:00
get canAccessEventLogs() {
return (this.isAdmin || this.permissions.accessEventLogs) && this.useEvents;
}
2021-12-16 13:36:21 +01:00
get canAccessImportExport() {
return this.isAdmin || this.permissions.accessImportExport;
}
2021-12-16 13:36:21 +01:00
get canAccessReports() {
return this.isAdmin || this.permissions.accessReports;
}
2021-12-16 13:36:21 +01:00
get canCreateNewCollections() {
return (
this.isManager ||
(this.permissions.createNewCollections ?? this.permissions.manageAllCollections)
);
}
2021-12-16 13:36:21 +01:00
get canEditAnyCollection() {
return (
this.isAdmin || (this.permissions.editAnyCollection ?? this.permissions.manageAllCollections)
);
}
2021-12-16 13:36:21 +01:00
get canDeleteAnyCollection() {
return (
this.isAdmin ||
(this.permissions.deleteAnyCollection ?? this.permissions.manageAllCollections)
);
}
2021-12-16 13:36:21 +01:00
get canViewAllCollections() {
return this.canCreateNewCollections || this.canEditAnyCollection || this.canDeleteAnyCollection;
}
2021-12-16 13:36:21 +01:00
get canEditAssignedCollections() {
return (
this.isManager ||
(this.permissions.editAssignedCollections ?? this.permissions.manageAssignedCollections)
);
}
2021-12-16 13:36:21 +01:00
get canDeleteAssignedCollections() {
return (
this.isManager ||
(this.permissions.deleteAssignedCollections ?? this.permissions.manageAssignedCollections)
);
}
2021-12-16 13:36:21 +01:00
get canViewAssignedCollections() {
return this.canDeleteAssignedCollections || this.canEditAssignedCollections;
}
2021-12-16 13:36:21 +01:00
get canManageGroups() {
return (this.isAdmin || this.permissions.manageGroups) && this.useGroups;
}
2021-12-16 13:36:21 +01:00
get canManageSso() {
return (this.isAdmin || this.permissions.manageSso) && this.useSso;
}
2021-12-16 13:36:21 +01:00
get canManageScim() {
return (this.isAdmin || this.permissions.manageScim) && this.useScim;
}
get canManagePolicies() {
return (this.isAdmin || this.permissions.managePolicies) && this.usePolicies;
}
2021-12-16 13:36:21 +01:00
get canManageUsers() {
return this.isAdmin || this.permissions.manageUsers;
}
2021-12-16 13:36:21 +01:00
get canManageUsersPassword() {
return this.isAdmin || this.permissions.manageResetPassword;
}
2021-12-16 13:36:21 +01:00
get isExemptFromPolicies() {
return this.canManagePolicies;
}
get canManageBilling() {
return this.isOwner && (this.isProviderUser || !this.hasProvider);
}
get hasProvider() {
return this.providerId != null || this.providerName != null;
}
[PS-1854] Split services between background and visualizations (#4075) * Elevate Map <-> Record JSON helpers to Utils * Build Account from a StateService provided AccountDeserializer * Allow Manifest V2 usage of session sync Expands use of SessionSyncer to all Subject types. Correctly handles replay buffer for each type to ignore the flood of data upon subscription to each Subject type. * Create browser-synced Policy Service * Move BrowserFolderService * Libs account serialization improvements * Serialize Browser Accounts * Separate StateService in background/visualizations Visualizer state services share storages with background page, which nicely emulates mv3 synchronization through session/local storage. There should not be multithreading issues since all of these services are still running through a single thread, we just now have multiple places we are reading/writing data from. Smaller improvements * Rename browser's state service to BrowserStateService * Remove unused WithPrototype decorator :celebrate: * Removed conversion on withPrototypeForArrayMembers. It's reasonable to think that if the type is maintained, it doesn't need conversion. Eventually, we should be able to remove the withPrototypeForArrayMembers decorator as well, but that will require a bit more work on (de)serialization of the Accounts.data property. * Make Record <-> Map idempotent Should we get in a situation where we _think_ an object has been jsonified, but hasn't been, we need to correctly deal with the object received to create our target. * Check all requirements while duck typing * Name client services after the client * Use union type to limit initialize options * Fixup usages of `initializeAs` * Add OrganizationService to synced services Co-Authored-By: Daniel James Smith <djsmith85@users.noreply.github.com> * Add Settings service to synced services Co-Authored-By: Daniel James Smith <djsmith85@users.noreply.github.com> * Add missing BrowserStateService * Fix factories to use browser-specific service overides * Fix org-service registration in services.module * Revert "Add missing BrowserStateService" This reverts commit 81cf384e872718e86e84f9c54731e78a083e1ee3. * Fix session syncer tests * Fix synced item metadata tests * Early return null json objects * Prefer abstract service dependencies * Prefer minimal browser service overrides * [SG-632] - Change forwarded providers radio buttons list to dropdown (#4045) * SG-632 - Changed forwarded providers list of radio buttons to dropdown * SG-632 - Added role attributes to improve accessibility. * SG-632 - Added sorting to array and empty option * SG-632 - Fix styling to match standards. * rename cipehrs component to vault items component (#4081) * Update the version hash for the QA Web build artifact to follow SemVer syntax (#4102) * Remove extra call to toJSON() (#4101) Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith@web.de> Co-authored-by: Carlos Gonçalves <carlosmaccam@gmail.com> Co-authored-by: Jake Fink <jfink@bitwarden.com> Co-authored-by: Joseph Flinn <58369717+joseph-flinn@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
2022-11-23 23:26:57 +01:00
static fromJSON(json: Jsonify<Organization>) {
if (json == null) {
return null;
}
return Object.assign(new Organization(), json, {
familySponsorshipLastSyncDate: new Date(json.familySponsorshipLastSyncDate),
familySponsorshipValidUntil: new Date(json.familySponsorshipValidUntil),
});
}
2018-05-18 21:26:46 +02:00
}