dev: update app approved_for props visibility

Allows owner users to read the approved_for properties on their own apps
This commit is contained in:
KernelDeimos 2024-10-18 20:12:08 -04:00
parent f5865daede
commit 4ce2dccc76
2 changed files with 23 additions and 3 deletions

View File

@ -181,6 +181,26 @@ class AppES extends BaseES {
return expected_uid === await entity.get('uid')
? origin : null ;
})());
const is_owner = await (async () => {
let owner = await entity.get('owner');
// TODO: why does this happen?
if ( typeof owner === 'number' ) {
owner = { id: owner };
}
if ( ! owner ) return false;
const actor = Context.get('actor');
return actor.type.user.id === owner.id;
})();
if ( ! is_owner ) {
for ( let i=0;i<20;i++ ) console.log('TYHIS IS HAPPEN');
entity.del('approved_for_listing');
entity.del('approved_for_opening_items');
entity.del('approved_for_incentive_program');
}
},
async maybe_insert_subdomain_ (entity) {
// Create and update is a situation where we might create a subdomain

View File

@ -128,15 +128,15 @@ module.exports = {
},
approved_for_listing: {
type: 'flag',
protected: true,
read_only: true,
},
approved_for_opening_items: {
type: 'flag',
protected: true,
read_only: true,
},
approved_for_incentive_program: {
type: 'flag',
protected: true,
read_only: true,
},
// SYSTEM