Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,10 @@ export const buildDataElement = (
return null;
}

if (trackedEntityAttribute.access?.read === false) {
return null;
}

return trackedEntityAttribute.valueType === dataElementTypes.DATE
? buildDateDataElement(optionSets, programTrackedEntityAttribute, trackedEntityAttribute, querySingleResource)
: buildBaseDataElement(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ export type TrackedEntityAttribute = {
unique?: boolean | null;
orgunitScope?: boolean | null;
pattern?: string | null;
access?: {
read?: boolean | null;
} | null;
};

export type ProgramTrackedEntityAttribute = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export type InputProgramData = {
};
valueType: string;
unique: boolean;
access?: {
read?: boolean | null;
} | null;
};
displayInList: boolean;
}>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const fields =
'options[id,displayName,code,style, translations]]]]],' +
'programTrackedEntityAttributes[trackedEntityAttribute[id,displayName,displayShortName,displayFormName,' +
'displayDescription,valueType,optionSetValue,unique,orgunitScope,pattern,translations[property,locale,value],' +
'optionSet[id,displayName,version,valueType,options[id,displayName,name,code,style,translations]]],' +
'optionSet[id,displayName,version,valueType,options[id,displayName,name,code,style,translations]],access[read]],' +
'displayInList,searchable,mandatory,renderOptionsAsRadio,allowFutureDate],' +
'trackedEntityType[id,access,displayName,allowAuditLog,minAttributesRequiredToSearch,featureType,' +
'trackedEntityTypeAttributes[trackedEntityAttribute[id],displayInList,mandatory,searchable],' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ export const useClientAttributesWithSubvalues = (
async (promisedAcc: Promise<any[]>, currentTEA) => {
const {
displayInList,
trackedEntityAttribute: { id, optionSet, valueType, unique, displayFormName },
trackedEntityAttribute: { id, optionSet, valueType, unique, displayFormName, access },
} = currentTEA;
const acc = await promisedAcc;
if (access?.read === false) {
return acc;
}
const foundAttribute = trackedEntityInstanceAttributes?.find(item => item.attribute === id);
let value;
if (foundAttribute) {
Expand All @@ -52,8 +56,6 @@ export const useClientAttributesWithSubvalues = (
}
}

const acc = await promisedAcc;

if (isMultiTextWithoutOptionset(valueType, optionSet)) {
log.error(errorCreator(MULIT_TEXT_WITH_NO_OPTIONS_SET)({ optionSet }));
return acc;
Expand Down