Browse Source

Merge branch 'develop' into fix/lose-admin-access

pull/2303/head
Wing-Kam Wong 3 years ago
parent
commit
f573b8c533
  1. 24
      .github/workflows/ci-cd.yml
  2. 22420
      package-lock.json
  3. 11250
      packages/nc-gui/package-lock.json
  4. 2
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2.ts
  5. 4
      packages/nocodb/src/lib/meta/NcMetaMgr.ts
  6. 4
      packages/nocodb/src/lib/meta/api/dataApis/dataAliasExportApis.ts
  7. 4
      packages/nocodb/src/lib/meta/api/exportApis.ts
  8. 4
      packages/nocodb/src/lib/meta/api/publicApis/publicDataExportApis.ts
  9. 12
      packages/nocodb/src/lib/meta/api/userApi/userApis.ts
  10. 20
      packages/nocodb/src/lib/models/User.ts
  11. 1
      scripts/cypress/integration/test/explicitLogin.js

24
.github/workflows/ci-cd.yml

@ -25,7 +25,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 16
node-version: 16.15.0
- name: Checkout
uses: actions/checkout@v2
with:
@ -70,7 +70,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 16
node-version: 16.15.0
- name: Checkout
uses: actions/checkout@v2
with:
@ -115,7 +115,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 16
node-version: 16.15.0
- name: Checkout
uses: actions/checkout@v2
with:
@ -160,7 +160,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 16
node-version: 16.15.0
- name: Checkout
uses: actions/checkout@v2
with:
@ -205,7 +205,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 16
node-version: 16.15.0
- name: Checkout
uses: actions/checkout@v2
with:
@ -250,7 +250,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 16
node-version: 16.15.0
- name: Checkout
uses: actions/checkout@v2
with:
@ -295,7 +295,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 16
node-version: 16.15.0
- name: Checkout
uses: actions/checkout@v2
with:
@ -340,7 +340,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 16
node-version: 16.15.0
- name: Checkout
uses: actions/checkout@v2
with:
@ -385,7 +385,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 16
node-version: 16.15.0
- name: Checkout
uses: actions/checkout@v2
with:
@ -430,7 +430,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 16
node-version: 16.15.0
- name: Checkout
uses: actions/checkout@v2
with:
@ -475,7 +475,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 16
node-version: 16.15.0
- name: Checkout
uses: actions/checkout@v2
with:
@ -520,7 +520,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 16
node-version: 16.15.0
- name: Checkout
uses: actions/checkout@v2
with:

22420
package-lock.json generated

File diff suppressed because it is too large Load Diff

11250
packages/nc-gui/package-lock.json generated

File diff suppressed because it is too large Load Diff

2
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/formulav2/formulaQueryBuilderv2.ts

@ -627,7 +627,7 @@ export default async function formulaQueryBuilderv2(
}
return query;
})
.join()})${colAlias}`
.join()})${colAlias}`.replace(/\?/g, '\\?')
);
} else if (pt.type === 'Literal') {
return knex.raw(`?${colAlias}`, [pt.value]);

4
packages/nocodb/src/lib/meta/NcMetaMgr.ts

@ -4551,7 +4551,9 @@ export default class NcMetaMgr {
'Access-Control-Expose-Headers': 'nc-export-offset',
'nc-export-offset': csvData.offset,
'nc-export-elapsed-time': csvData.elapsed,
'Content-Disposition': `attachment; filename="${args.args.model_name}-export.csv"`
'Content-Disposition': `attachment; filename="${encodeURI(
args.args.model_name
)}-export.csv"`
});
res.send(csvData.data);
}

4
packages/nocodb/src/lib/meta/api/dataApis/dataAliasExportApis.ts

@ -15,7 +15,9 @@ async function csvDataExport(req: Request, res: Response) {
'Access-Control-Expose-Headers': 'nc-export-offset',
'nc-export-offset': offset,
'nc-export-elapsed-time': elapsed,
'Content-Disposition': `attachment; filename="${view.title}-export.csv"`
'Content-Disposition': `attachment; filename="${encodeURI(
view.title
)}-export.csv"`
});
res.send(data);
}

4
packages/nocodb/src/lib/meta/api/exportApis.ts

@ -11,7 +11,9 @@ async function exportCsv(req: Request, res: Response) {
'Access-Control-Expose-Headers': 'nc-export-offset',
'nc-export-offset': offset,
'nc-export-elapsed-time': elapsed,
'Content-Disposition': `attachment; filename="${view.title}-export.csv"`
'Content-Disposition': `attachment; filename="${encodeURI(
view.title
)}-export.csv"`
});
res.send(data);
}

4
packages/nocodb/src/lib/meta/api/publicApis/publicDataExportApis.ts

@ -122,7 +122,9 @@ async function exportCsv(req: Request, res: Response) {
'Access-Control-Expose-Headers': 'nc-export-offset',
'nc-export-offset': offset,
'nc-export-elapsed-time': elapsed,
'Content-Disposition': `attachment; filename="${view.title}-export.csv"`
'Content-Disposition': `attachment; filename="${encodeURI(
view.title
)}-export.csv"`
});
res.send(data);
}

12
packages/nocodb/src/lib/meta/api/userApi/userApis.ts

@ -284,7 +284,8 @@ async function passwordChange(req: Request<any, any>, res): Promise<any> {
await User.update(user.id, {
salt,
password
password,
email: user.email
});
Audit.insert({
@ -324,12 +325,13 @@ async function passwordForgot(req: Request<any, any>, res): Promise<any> {
(req as any).ncSiteUrl
}/api/v1/db/auth/password/reset/${token}.`,
html: ejs.render(template, {
resetLink: (req as any).ncSiteUrl + `/api/v1/db/auth/password/reset/${token}`
resetLink:
(req as any).ncSiteUrl + `/api/v1/db/auth/password/reset/${token}`
})
})
);
} catch (e) {
console.log(e)
console.log(e);
return NcError.badRequest(
'Email Plugin is not found. Please contact administrators to configure it in App Store first.'
);
@ -343,9 +345,7 @@ async function passwordForgot(req: Request<any, any>, res): Promise<any> {
ip: (req as any).clientIp
});
} else {
return NcError.badRequest(
'Your email has not been registered.'
);
return NcError.badRequest('Your email has not been registered.');
}
res.json({ msg: 'Please check your email to reset the password' });
}

20
packages/nocodb/src/lib/models/User.ts

@ -74,23 +74,23 @@ export default class User implements UserType {
'roles'
]);
// get existing cache
let key = `${CacheScope.USER}:${id}`;
let o = await NocoCache.get(key, CacheGetType.TYPE_OBJECT);
if (o) {
o = { ...o, ...updateObj };
// set cache
await NocoCache.set(key, o);
{
const keys = [
// update user:<id>
`${CacheScope.USER}:${id}`,
// update user:<email>
key = `${CacheScope.USER}:${o.email}`;
o = await NocoCache.get(key, CacheGetType.TYPE_OBJECT);
`${CacheScope.USER}:${user.email}`
];
for (const key of keys) {
let o = await NocoCache.get(key, CacheGetType.TYPE_OBJECT);
if (o) {
o = { ...o, ...updateObj };
// set cache
await NocoCache.set(key, o);
}
}
}
// as <projectId> is unknown, delete user:<email>___<projectId> in cache
await NocoCache.delAll(CacheScope.USER, `${user.email}___*`);
// set meta
return await ncMeta.metaUpdate(null, null, MetaTable.USERS, updateObj, id);
}

1
scripts/cypress/integration/test/explicitLogin.js

@ -10,7 +10,6 @@ export const genTest = (apiType, dbType) => {
before(() => {
// loginPage.loginAndOpenProject(apiType, dbType);
// open a table to work on views
//
// cy.openTableTab('City');
});

Loading…
Cancel
Save