Skip to content
Open
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
3 changes: 1 addition & 2 deletions src/routes/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
import listBuckets from '../storage/bucket/list.js';
import listObjects from '../storage/object/list.js';
import { getChildRules, hasPermission } from '../utils/auth.js';

export default async function getList({ env, daCtx }) {
if (!daCtx.org) return listBuckets(env, daCtx);
if (!daCtx.org) return { status: 404 };
if (!hasPermission(daCtx, daCtx.key, 'read')) return { status: 403 };

// Get the child rules of the current folder and store this in daCtx.aclCtx
Expand Down
43 changes: 0 additions & 43 deletions src/storage/bucket/list.js

This file was deleted.

7 changes: 7 additions & 0 deletions test/routes/list.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,11 @@ describe('List Route', () => {
assert.strictEqual(1, childRules.length);
assert(childRules[0].startsWith('/q/q/**='), 'Should have defined some child rule');
});

it('returns 404 when no org is present', async () => {
const getList = await import('../../src/routes/list.js');

const res = await getList.default({ env: {}, daCtx: {}, aclCtx: {} });
assert.strictEqual(404, res.status);
})
});
28 changes: 0 additions & 28 deletions test/storage/bucket/list.test.js

This file was deleted.

59 changes: 0 additions & 59 deletions test/storage/bucket/mocks/env.js

This file was deleted.