@openforis/arena-core 2.18.9 → 2.18.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/auth/users.js
CHANGED
|
@@ -10,9 +10,12 @@ const isSystemAdmin = (user) => getAuthGroups(user).some(authGroups_1.AuthGroups
|
|
|
10
10
|
const isSurveyManager = (user) => getAuthGroups(user).some(authGroups_1.AuthGroups.isSurveyManager);
|
|
11
11
|
const getAuthGroupBySurveyUuid = (surveyUuid, includeSystemAdmin = true) => (user) => {
|
|
12
12
|
const authGroups = getAuthGroups(user);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
if (includeSystemAdmin && isSystemAdmin(user))
|
|
14
|
+
return authGroups.find(authGroups_1.AuthGroups.isSystemAdmin);
|
|
15
|
+
// without a survey uuid no survey group can match (groups not associated to a survey, e.g. survey manager, have no survey uuid)
|
|
16
|
+
if (!surveyUuid)
|
|
17
|
+
return undefined;
|
|
18
|
+
return authGroups.find((authGroup) => authGroup.surveyUuid === surveyUuid);
|
|
16
19
|
};
|
|
17
20
|
const getAuthGroupByName = (groupName) => (user) => {
|
|
18
21
|
const authGroups = getAuthGroups(user);
|
package/dist/auth/users.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../src/auth/users.ts"],"names":[],"mappings":";;;AAEA,6CAAyC;AACzC,iCAAwD;AAExD,MAAM,iBAAiB,GAAG,CAAC,CAAA;AAE3B,MAAM,WAAW,GAAG,CAAC,IAAU,EAAW,EAAE,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,MAAK,iBAAU,CAAC,QAAQ,CAAA;AAEjF,MAAM,aAAa,GAAG,CAAC,IAAU,EAAmB,EAAE,wBAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,mCAAI,EAAE,GAAA,CAAA;AAE7E,MAAM,aAAa,GAAG,C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M,OAAO,GACX,CAAC,aAAmB,EAAE,EAAE,CACxB,CAAC,IAAU,EAAW,EAAE,CACtB,IAAI,IAAI,aAAa,CAAC,CAAC,CAAC,IAAI,KAAK,aAAa,IAAI,IAAI,CAAC,IAAI,KAAK,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAA;AAEjF,QAAA,KAAK,GAAG;IACnB,WAAW;IACX,aAAa;IACb,aAAa;IACb,eAAe;IACf,wBAAwB;IACxB,kBAAkB;IAClB,qBAAqB;IACrB,aAAa;IACb,OAAO;CACR,CAAA","sourcesContent":["import { Dictionary } from '../common'\nimport { AuthGroupName } from './authGroup'\nimport { AuthGroups } from './authGroups'\nimport { User, UserAuthGroup, UserStatus } from './user'\n\nconst defaultMaxSurveys = 5\n\nconst hasAccepted = (user: User): boolean => user?.status === UserStatus.ACCEPTED\n\nconst getAuthGroups = (user: User): UserAuthGroup[] => user?.authGroups ?? []\n\nconst isSystemAdmin = (user: User): boolean => getAuthGroups(user).some(AuthGroups.isSystemAdmin)\n\nconst isSurveyManager = (user: User): boolean => getAuthGroups(user).some(AuthGroups.isSurveyManager)\n\nconst getAuthGroupBySurveyUuid =\n (surveyUuid?: string, includeSystemAdmin = true) =>\n (user: User): UserAuthGroup | undefined => {\n const authGroups = getAuthGroups(user)\n if (includeSystemAdmin && isSystemAdmin(user)) return authGroups.find(AuthGroups.isSystemAdmin)\n // without a survey uuid no survey group can match (groups not associated to a survey, e.g. survey manager, have no survey uuid)\n if (!surveyUuid) return undefined\n return authGroups.find((authGroup) => authGroup.surveyUuid === surveyUuid)\n }\n\nconst getAuthGroupByName = (groupName: AuthGroupName) => (user: User) => {\n const authGroups = getAuthGroups(user)\n return authGroups.find((group) => group.name === groupName)\n}\n\nconst getCombinedExtraProps =\n (surveyUuid: string) =>\n (user: User): Dictionary<any> => {\n const userSurveyAuthGroup = user ? Users.getAuthGroupBySurveyUuid(surveyUuid)(user) : null\n const userAuthGroupExtraProps = userSurveyAuthGroup?.props?.extra ?? {}\n const userExtraProps = user?.props.extra ?? {}\n // user auth group extra props overwrite user extra props\n return { ...userExtraProps, ...userAuthGroupExtraProps }\n }\n\nconst getMaxSurveys = (user: User) => user.props?.maxSurveys ?? defaultMaxSurveys\n\nconst isEqual =\n (userToCompare: User) =>\n (user: User): boolean =>\n user && userToCompare ? user === userToCompare || user.uuid === userToCompare.uuid : false\n\nexport const Users = {\n hasAccepted,\n getAuthGroups,\n isSystemAdmin,\n isSurveyManager,\n getAuthGroupBySurveyUuid,\n getAuthGroupByName,\n getCombinedExtraProps,\n getMaxSurveys,\n isEqual,\n}\n"]}
|
package/dist/esm/auth/users.js
CHANGED
|
@@ -7,9 +7,12 @@ const isSystemAdmin = (user) => getAuthGroups(user).some(AuthGroups.isSystemAdmi
|
|
|
7
7
|
const isSurveyManager = (user) => getAuthGroups(user).some(AuthGroups.isSurveyManager);
|
|
8
8
|
const getAuthGroupBySurveyUuid = (surveyUuid, includeSystemAdmin = true) => (user) => {
|
|
9
9
|
const authGroups = getAuthGroups(user);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
if (includeSystemAdmin && isSystemAdmin(user))
|
|
11
|
+
return authGroups.find(AuthGroups.isSystemAdmin);
|
|
12
|
+
// without a survey uuid no survey group can match (groups not associated to a survey, e.g. survey manager, have no survey uuid)
|
|
13
|
+
if (!surveyUuid)
|
|
14
|
+
return undefined;
|
|
15
|
+
return authGroups.find((authGroup) => authGroup.surveyUuid === surveyUuid);
|
|
13
16
|
};
|
|
14
17
|
const getAuthGroupByName = (groupName) => (user) => {
|
|
15
18
|
const authGroups = getAuthGroups(user);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../../src/auth/users.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAuB,UAAU,EAAE,MAAM,QAAQ,CAAA;AAExD,MAAM,iBAAiB,GAAG,C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mBAAmB,CAAE,KAAK,0CAAE,KAAK,mCAAI,EAAE,CAAA;IACvE,MAAM,cAAc,SAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAC,KAAK,mCAAI,EAAE,CAAA;IAC9C,yDAAyD;IACzD,uCAAY,cAAc,GAAK,uBAAuB,EAAE;AAC1D,CAAC,CAAA;AAEH,MAAM,aAAa,GAAG,CAAC,IAAU,EAAE,EAAE,gCAAC,MAAA,IAAI,CAAC,KAAK,0CAAE,UAAU,mCAAI,iBAAiB,GAAA,CAAA;AAEjF,MAAM,OAAO,GACX,CAAC,aAAmB,EAAE,EAAE,CACxB,CAAC,IAAU,EAAW,EAAE,CACtB,IAAI,IAAI,aAAa,CAAC,CAAC,CAAC,IAAI,KAAK,aAAa,IAAI,IAAI,CAAC,IAAI,KAAK,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAA;AAE9F,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,WAAW;IACX,aAAa;IACb,aAAa;IACb,eAAe;IACf,wBAAwB;IACxB,kBAAkB;IAClB,qBAAqB;IACrB,aAAa;IACb,OAAO;CACR,CAAA","sourcesContent":["import { Dictionary } from '../common'\nimport { AuthGroupName } from './authGroup'\nimport { AuthGroups } from './authGroups'\nimport { User, UserAuthGroup, UserStatus } from './user'\n\nconst defaultMaxSurveys = 5\n\nconst hasAccepted = (user: User): boolean => user?.status === UserStatus.ACCEPTED\n\nconst getAuthGroups = (user: User): UserAuthGroup[] => user?.authGroups ?? []\n\nconst isSystemAdmin = (user: User): boolean => getAuthGroups(user).some(AuthGroups.isSystemAdmin)\n\nconst isSurveyManager = (user: User): boolean => getAuthGroups(user).some(AuthGroups.isSurveyManager)\n\nconst getAuthGroupBySurveyUuid =\n (surveyUuid?: string, includeSystemAdmin = true) =>\n (user: User): UserAuthGroup | undefined => {\n const authGroups = getAuthGroups(user)\n if (includeSystemAdmin && isSystemAdmin(user)) return authGroups.find(AuthGroups.isSystemAdmin)\n // without a survey uuid no survey group can match (groups not associated to a survey, e.g. survey manager, have no survey uuid)\n if (!surveyUuid) return undefined\n return authGroups.find((authGroup) => authGroup.surveyUuid === surveyUuid)\n }\n\nconst getAuthGroupByName = (groupName: AuthGroupName) => (user: User) => {\n const authGroups = getAuthGroups(user)\n return authGroups.find((group) => group.name === groupName)\n}\n\nconst getCombinedExtraProps =\n (surveyUuid: string) =>\n (user: User): Dictionary<any> => {\n const userSurveyAuthGroup = user ? Users.getAuthGroupBySurveyUuid(surveyUuid)(user) : null\n const userAuthGroupExtraProps = userSurveyAuthGroup?.props?.extra ?? {}\n const userExtraProps = user?.props.extra ?? {}\n // user auth group extra props overwrite user extra props\n return { ...userExtraProps, ...userAuthGroupExtraProps }\n }\n\nconst getMaxSurveys = (user: User) => user.props?.maxSurveys ?? defaultMaxSurveys\n\nconst isEqual =\n (userToCompare: User) =>\n (user: User): boolean =>\n user && userToCompare ? user === userToCompare || user.uuid === userToCompare.uuid : false\n\nexport const Users = {\n hasAccepted,\n getAuthGroups,\n isSystemAdmin,\n isSurveyManager,\n getAuthGroupBySurveyUuid,\n getAuthGroupByName,\n getCombinedExtraProps,\n getMaxSurveys,\n isEqual,\n}\n"]}
|