mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-11-15 11:38:22 +00:00
Add test for certificate validation with view-only permission
This commit is contained in:
1 parent
6acf346262
commit
f1bd157438
1 file changed
+44
@@ -48,6 +48,50 @@ describe('Certificates endpoints', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('User with certificates view permission cannot validate custom certificate', () => {
|
||||
const viewer = {
|
||||
email: 'viewer@example.com',
|
||||
secret: 'changeme',
|
||||
};
|
||||
|
||||
cy.task('backendApiPost', {
|
||||
token: token,
|
||||
path: '/api/users',
|
||||
data: {
|
||||
name: 'Certificate Viewer',
|
||||
nickname: 'Viewer',
|
||||
email: viewer.email,
|
||||
roles: ['user'],
|
||||
auth: {
|
||||
type: 'password',
|
||||
secret: viewer.secret,
|
||||
},
|
||||
},
|
||||
}).then((user) => {
|
||||
cy.task('backendApiPut', {
|
||||
token: token,
|
||||
path: `/api/users/${user.id}/permissions`,
|
||||
data: {
|
||||
certificates: 'view',
|
||||
},
|
||||
});
|
||||
|
||||
cy.getToken(null, {identity: viewer.email, secret: viewer.secret}).then((viewerToken) => {
|
||||
cy.task('backendApiPostFiles', {
|
||||
token: viewerToken,
|
||||
path: '/api/nginx/certificates/validate',
|
||||
files: {
|
||||
certificate: certFile,
|
||||
certificate_key: keyFile,
|
||||
},
|
||||
returnOnError: true,
|
||||
}).then((data) => {
|
||||
expect(data.error.code).to.equal(403);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('Custom certificate lifecycle', () => {
|
||||
// Create custom cert
|
||||
cy.task('backendApiPost', {
|
||||
|
||||
Reference in new issue
Block a user