mirror of
https://github.com/Unleash/unleash.git
synced 2025-08-04 13:48:56 +02:00
fix: connect environment with access service
This commit is contained in:
parent
73d270d11f
commit
d8ab79f71c
@ -14,6 +14,7 @@ interface PermissionChecker {
|
|||||||
user: User,
|
user: User,
|
||||||
permission: string,
|
permission: string,
|
||||||
projectId?: string,
|
projectId?: string,
|
||||||
|
environment?: string,
|
||||||
): Promise<boolean>;
|
): Promise<boolean>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +45,7 @@ const rbacMiddleware = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For /api/admin/projects/:projectId we will find it as part of params
|
// For /api/admin/projects/:projectId we will find it as part of params
|
||||||
let { projectId } = params;
|
let { projectId, environment } = params;
|
||||||
|
|
||||||
// Temporary workaround to figure out projectId for feature toggle updates.
|
// Temporary workaround to figure out projectId for feature toggle updates.
|
||||||
// will be removed in Unleash v5.0
|
// will be removed in Unleash v5.0
|
||||||
@ -55,7 +56,12 @@ const rbacMiddleware = (
|
|||||||
projectId = req.body.project || 'default';
|
projectId = req.body.project || 'default';
|
||||||
}
|
}
|
||||||
|
|
||||||
return accessService.hasPermission(user, permission, projectId);
|
return accessService.hasPermission(
|
||||||
|
user,
|
||||||
|
permission,
|
||||||
|
projectId,
|
||||||
|
environment,
|
||||||
|
);
|
||||||
};
|
};
|
||||||
return next();
|
return next();
|
||||||
};
|
};
|
||||||
|
@ -8,6 +8,7 @@ import { Logger } from '../../../logger';
|
|||||||
import {
|
import {
|
||||||
CREATE_FEATURE,
|
CREATE_FEATURE,
|
||||||
DELETE_FEATURE,
|
DELETE_FEATURE,
|
||||||
|
CREATE_FEATURE_STRATEGY,
|
||||||
UPDATE_FEATURE,
|
UPDATE_FEATURE,
|
||||||
} from '../../../types/permissions';
|
} from '../../../types/permissions';
|
||||||
import {
|
import {
|
||||||
@ -75,7 +76,11 @@ export default class ProjectFeaturesController extends Controller {
|
|||||||
|
|
||||||
// activation strategies
|
// activation strategies
|
||||||
this.get(`${PATH_STRATEGIES}`, this.getStrategies);
|
this.get(`${PATH_STRATEGIES}`, this.getStrategies);
|
||||||
this.post(`${PATH_STRATEGIES}`, this.addStrategy, UPDATE_FEATURE);
|
this.post(
|
||||||
|
`${PATH_STRATEGIES}`,
|
||||||
|
this.addStrategy,
|
||||||
|
CREATE_FEATURE_STRATEGY,
|
||||||
|
);
|
||||||
this.get(`${PATH_STRATEGY}`, this.getStrategy);
|
this.get(`${PATH_STRATEGY}`, this.getStrategy);
|
||||||
this.put(`${PATH_STRATEGY}`, this.updateStrategy, UPDATE_FEATURE);
|
this.put(`${PATH_STRATEGY}`, this.updateStrategy, UPDATE_FEATURE);
|
||||||
this.patch(`${PATH_STRATEGY}`, this.patchStrategy, UPDATE_FEATURE);
|
this.patch(`${PATH_STRATEGY}`, this.patchStrategy, UPDATE_FEATURE);
|
||||||
|
Loading…
Reference in New Issue
Block a user