mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
System permissions for app access (#4004)
* Pass relations through schema, instead of individual reads * Fetch field transforms upfront * Fix length check * List if user has app access or not in accountability * Load permissions up front, merge app access minimal permissions * Show app access required permissions in permissions overview * Show system minimal permissions in permissions detail * Fix app access check in authenticate for jwt use * Fix minimal permissions for presets * Remove /permissions/me in favor of root use w/ permissions * Fix logical nested OR in an AND * Use root permissions endpoint with filter instead of /me * Allow filter query on /permissions * Add system minimal app access permissions into result of /permissions * Remove stray console log * Remove stray console.dir * Set current role as role for minimal permissions * Fix no-permissions state for user detail * Add filter items function that allows altering existing result set
This commit is contained in:
@@ -2,6 +2,7 @@ import env from '../../../env';
|
||||
import logger from '../../../logger';
|
||||
import installDatabase from '../../../database/seeds/run';
|
||||
import runMigrations from '../../../database/migrations/run';
|
||||
import { getSchema } from '../../../utils/get-schema';
|
||||
import { nanoid } from 'nanoid';
|
||||
|
||||
export default async function bootstrap() {
|
||||
@@ -22,7 +23,7 @@ export default async function bootstrap() {
|
||||
|
||||
await installDatabase(database);
|
||||
|
||||
const schema = await schemaInspector.overview();
|
||||
const schema = await getSchema();
|
||||
|
||||
logger.info('Setting up first admin role...');
|
||||
const rolesService = new RolesService({ schema });
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { getSchema } from '../../../utils/get-schema';
|
||||
|
||||
export default async function rolesCreate({ name, admin }: any) {
|
||||
const { default: database, schemaInspector } = require('../../../database/index');
|
||||
const { default: database } = require('../../../database/index');
|
||||
const { RolesService } = require('../../../services/roles');
|
||||
|
||||
if (!name) {
|
||||
@@ -8,7 +10,7 @@ export default async function rolesCreate({ name, admin }: any) {
|
||||
}
|
||||
|
||||
try {
|
||||
const schema = await schemaInspector.overview();
|
||||
const schema = await getSchema();
|
||||
const service = new RolesService({ schema: schema, knex: database });
|
||||
|
||||
const id = await service.create({ name, admin_access: admin });
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { getSchema } from '../../../utils/get-schema';
|
||||
|
||||
export default async function usersCreate({ email, password, role }: any) {
|
||||
const { default: database, schemaInspector } = require('../../../database/index');
|
||||
const { UsersService } = require('../../../services/users');
|
||||
@@ -8,7 +10,7 @@ export default async function usersCreate({ email, password, role }: any) {
|
||||
}
|
||||
|
||||
try {
|
||||
const schema = await schemaInspector.overview();
|
||||
const schema = await getSchema();
|
||||
const service = new UsersService({ schema, knex: database });
|
||||
|
||||
const id = await service.create({ email, password, role, status: 'active' });
|
||||
|
||||
Reference in New Issue
Block a user