|
|
@@ -1,9 +1,10 @@
|
|
|
import { AnyJson, organizationState, OrganizationStore } from '~/types/interfaces'
|
|
|
|
|
|
/**
|
|
|
- * @category Services/profiles
|
|
|
- * @class OrganizationProfile
|
|
|
- * Classe répondant aux différentes questions que l'on peut se poser sur l'organization de l'access connecté
|
|
|
+ * L'AccessProfile regroupe toutes les informations concernant l'Organization auquel
|
|
|
+ * l'access courant est connecté et qui peuvent être nécessaires pour l'affichage
|
|
|
+ * de chacune des pages de l'application
|
|
|
+ * (ex: modules, produit, ...etc)
|
|
|
*/
|
|
|
class OrganizationProfile {
|
|
|
private organizationProfile: organizationState
|
|
|
@@ -17,7 +18,8 @@ class OrganizationProfile {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Est-ce que l'organisation possède le module
|
|
|
+ * Est-ce que l'organisation possède le module donné
|
|
|
+ *
|
|
|
* @param {Array<string>} modules Modules à tester
|
|
|
* @return {boolean}
|
|
|
*/
|
|
|
@@ -31,6 +33,7 @@ class OrganizationProfile {
|
|
|
|
|
|
/**
|
|
|
* L'organization fait-elle partie d'un réseau ?
|
|
|
+ *
|
|
|
* @return {boolean}
|
|
|
*/
|
|
|
isInsideNetwork (): boolean {
|
|
|
@@ -38,45 +41,46 @@ class OrganizationProfile {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * L'organization fait-elle partie du réseau CMF ?
|
|
|
+ * L'organization fait-elle partie du réseau CMF?
|
|
|
+ *
|
|
|
* @return {boolean}
|
|
|
*/
|
|
|
isCmf (): boolean {
|
|
|
- const networks = this.organizationProfile.networks.filter((network:string) => {
|
|
|
- return network == process.env.cmf_network
|
|
|
- })
|
|
|
- return networks.length > 0
|
|
|
+ return this.organizationProfile.networks.filter((network: string) => {
|
|
|
+ return network === process.env.cmf_network
|
|
|
+ }).length > 0
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * L'organization fait-elle partie du réseau FFEC ?
|
|
|
+ * L'organization fait-elle partie du réseau FFEC?
|
|
|
+ *
|
|
|
* @return {boolean}
|
|
|
*/
|
|
|
isFfec (): boolean {
|
|
|
- const networks = this.organizationProfile.networks.filter((network:string) => {
|
|
|
- return network == process.env.ffec_network
|
|
|
- })
|
|
|
- return networks.length > 0
|
|
|
+ return this.organizationProfile.networks.filter((network: string) => {
|
|
|
+ return network === process.env.ffec_network
|
|
|
+ }).length > 0
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * L'organization possède t'elle un produit school ou school premium
|
|
|
+ * L'organization possède t'elle un produit premium
|
|
|
* @return {boolean}
|
|
|
*/
|
|
|
- isSchool (): boolean {
|
|
|
- return this.isSchoolProduct() || this.isSchoolPremiumProduct()
|
|
|
+ isArtistProduct (): boolean {
|
|
|
+ return this.organizationProfile.product === process.env.artist_product
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * L'organization possède t'elle un produit artiste ou artiste premium
|
|
|
+ * L'organization possède t'elle un produit artiste premium
|
|
|
* @return {boolean}
|
|
|
*/
|
|
|
- isArtist (): boolean {
|
|
|
- return this.isArtistProduct() || this.isArtistPremiumProduct()
|
|
|
+ isArtistPremiumProduct (): boolean {
|
|
|
+ return this.organizationProfile.product === process.env.artist_premium_product
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * L'organization possède t'elle un produit school
|
|
|
+ * L'organization possède-t-elle un produit school?
|
|
|
+ *
|
|
|
* @return {boolean}
|
|
|
*/
|
|
|
isSchoolProduct (): boolean {
|
|
|
@@ -84,7 +88,8 @@ class OrganizationProfile {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * L'organization possède t'elle un produit school premium
|
|
|
+ * L'organization possède-t-elle un produit school-premium?
|
|
|
+ *
|
|
|
* @return {boolean}
|
|
|
*/
|
|
|
isSchoolPremiumProduct (): boolean {
|
|
|
@@ -92,19 +97,19 @@ class OrganizationProfile {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * L'organization possède t'elle un produit premium
|
|
|
+ * L'organization possède-t-elle un produit school ou school-premium
|
|
|
* @return {boolean}
|
|
|
*/
|
|
|
- isArtistProduct (): boolean {
|
|
|
- return this.organizationProfile.product === process.env.artist_product
|
|
|
+ isSchool (): boolean {
|
|
|
+ return this.isSchoolProduct() || this.isSchoolPremiumProduct()
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * L'organization possède t'elle un produit artiste premium
|
|
|
+ * L'organization possède t'elle un produit artiste ou artiste premium
|
|
|
* @return {boolean}
|
|
|
*/
|
|
|
- isArtistPremiumProduct (): boolean {
|
|
|
- return this.organizationProfile.product === process.env.artist_premium_product
|
|
|
+ isArtist (): boolean {
|
|
|
+ return this.isArtistProduct() || this.isArtistPremiumProduct()
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -116,15 +121,16 @@ class OrganizationProfile {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * L'organization possède t'elledes enfants
|
|
|
+ * L'organization possède-t-elle des enfants
|
|
|
* @return {boolean|null}
|
|
|
*/
|
|
|
- isOrganizationWithChildren (): any {
|
|
|
+ hasChildren (): any {
|
|
|
return this.organizationProfile.hasChildren
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Factory
|
|
|
+ *
|
|
|
* @return {AnyJson} retourne les fonction rendues publiques
|
|
|
*/
|
|
|
handler (): AnyJson {
|
|
|
@@ -133,7 +139,7 @@ class OrganizationProfile {
|
|
|
isSchool: this.isSchool.bind(this),
|
|
|
isArtist: this.isArtist.bind(this),
|
|
|
isManagerProduct: this.isManagerProduct.bind(this),
|
|
|
- isOrganizationWithChildren: this.isOrganizationWithChildren.bind(this),
|
|
|
+ isOrganizationWithChildren: this.hasChildren.bind(this),
|
|
|
isCmf: this.isCmf.bind(this)
|
|
|
}
|
|
|
}
|