mirror of
https://github.com/directus/directus.git
synced 2026-02-18 09:11:56 -05:00
Support CSV in dir_fields.special, add "conceal"
This commit is contained in:
@@ -804,7 +804,7 @@ rows:
|
||||
width: half
|
||||
- collection: directus_users
|
||||
field: password
|
||||
special: hash
|
||||
special: hash, conceal
|
||||
interface: hash
|
||||
locked: true
|
||||
options:
|
||||
|
||||
@@ -87,7 +87,13 @@ export default class PayloadService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
},
|
||||
async conceal(operation, value) {
|
||||
if (operation === 'read') return '**********';
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
processValues(operation: Operation, payloads: Partial<Item>[]): Promise<Partial<Item>[]>;
|
||||
@@ -149,11 +155,20 @@ export default class PayloadService {
|
||||
) {
|
||||
if (!field.special) return payload[field.field];
|
||||
|
||||
if (this.transformers.hasOwnProperty(field.special)) {
|
||||
return await this.transformers[field.special](operation, payload[field.field], payload);
|
||||
const fieldSpecials = field.special.split(',').map(s => s.trim());
|
||||
|
||||
|
||||
let value = clone(payload[field.field]);
|
||||
|
||||
if (field.field === 'password') console.log(value);
|
||||
|
||||
for (const special of fieldSpecials) {
|
||||
if (this.transformers.hasOwnProperty(special)) {
|
||||
value = await this.transformers[special](operation, value, payload);
|
||||
}
|
||||
}
|
||||
|
||||
return payload[field.field];
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -267,3 +282,4 @@ export default class PayloadService {
|
||||
}
|
||||
}
|
||||
}
|
||||
0
|
||||
|
||||
Reference in New Issue
Block a user