|
|
@@ -97,16 +97,15 @@ export const useAccessProfileStore = defineStore('accessProfile', () => {
|
|
|
return roles.value && roles.value.includes(role)
|
|
|
}
|
|
|
|
|
|
- const setProfile = (profile: any) => {
|
|
|
- const profileRoles: Array<string> = Array.from(Object.values(profile.roles))
|
|
|
+ /**
|
|
|
+ * /!\ Server-side only
|
|
|
+ *
|
|
|
+ * @param profile
|
|
|
+ * @param abilitiesValue
|
|
|
+ */
|
|
|
+ const initiateProfile = (profile: any): void => {
|
|
|
|
|
|
- name.value = profile.name
|
|
|
- givenName.value = profile.givenName
|
|
|
- gender.value = profile.gender
|
|
|
- avatarId.value = profile.avatarId
|
|
|
- activityYear.value = profile.activityYear
|
|
|
- historical.value = profile.historical
|
|
|
- isAdminAccess.value = profile.isAdminAccess
|
|
|
+ const profileRoles: Array<string> = Array.from(Object.values(profile.roles))
|
|
|
|
|
|
isAdmin.value = RoleUtils.isA('ADMIN', profileRoles)
|
|
|
isAdministratifManager.value = RoleUtils.isA('ADMINISTRATIF_MANAGER', profileRoles)
|
|
|
@@ -117,9 +116,21 @@ export const useAccessProfileStore = defineStore('accessProfile', () => {
|
|
|
isTeacher.value = RoleUtils.isA('TEACHER', profileRoles)
|
|
|
isMember.value = RoleUtils.isA('MEMBER', profileRoles)
|
|
|
isOther.value = RoleUtils.isA('OTHER', profileRoles)
|
|
|
+ roles.value = RoleUtils.filterFunctionRoles(profileRoles)
|
|
|
+
|
|
|
+ setProfile(profile)
|
|
|
+ }
|
|
|
+
|
|
|
+ const setProfile = (profile: any): void => {
|
|
|
+ name.value = profile.name
|
|
|
+ givenName.value = profile.givenName
|
|
|
+ gender.value = profile.gender
|
|
|
+ avatarId.value = profile.avatarId
|
|
|
+ activityYear.value = profile.activityYear
|
|
|
+ historical.value = profile.historical
|
|
|
+ isAdminAccess.value = profile.isAdminAccess
|
|
|
isGuardian.value = profile.isGuardian
|
|
|
isPayer.value = profile.isPayor
|
|
|
- roles.value = RoleUtils.filterFunctionRoles(profileRoles)
|
|
|
|
|
|
// Add the original Access (switch User case)
|
|
|
if (profile.originalAccess !== null) {
|
|
|
@@ -142,11 +153,6 @@ export const useAccessProfileStore = defineStore('accessProfile', () => {
|
|
|
|
|
|
// Set family-accesses
|
|
|
setFamilyAccesses(Array.from(profile.familyAccesses))
|
|
|
-
|
|
|
- // Set organization profile
|
|
|
- // TODO: à voir si c'est bien d'appeler un autre store d'ici où s'il vaudrait mieux le faire dans la couche supérieure
|
|
|
- const organizationProfile = useOrganizationProfileStore()
|
|
|
- organizationProfile.setProfile(profile.organization)
|
|
|
}
|
|
|
|
|
|
const setHistorical = (past: boolean, present: boolean, future: boolean) => {
|
|
|
@@ -199,6 +205,7 @@ export const useAccessProfileStore = defineStore('accessProfile', () => {
|
|
|
currentAccessId,
|
|
|
setMultiAccesses,
|
|
|
setFamilyAccesses,
|
|
|
+ initiateProfile,
|
|
|
setProfile,
|
|
|
setHistorical,
|
|
|
setHistoricalRange
|