mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-19 00:15:43 +01:00
fix: connect environment with access service
This commit is contained in:
parent
73d270d11f
commit
d8ab79f71c
@ -14,6 +14,7 @@ interface PermissionChecker {
|
||||
user: User,
|
||||
permission: string,
|
||||
projectId?: string,
|
||||
environment?: string,
|
||||
): Promise<boolean>;
|
||||
}
|
||||
|
||||
@ -44,7 +45,7 @@ const rbacMiddleware = (
|
||||
}
|
||||
|
||||
// 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.
|
||||
// will be removed in Unleash v5.0
|
||||
@ -55,7 +56,12 @@ const rbacMiddleware = (
|
||||
projectId = req.body.project || 'default';
|
||||
}
|
||||
|
||||
return accessService.hasPermission(user, permission, projectId);
|
||||
return accessService.hasPermission(
|
||||
user,
|
||||
permission,
|
||||
projectId,
|
||||
environment,
|
||||
);
|
||||
};
|
||||
return next();
|
||||
};
|
||||
|
@ -8,6 +8,7 @@ import { Logger } from '../../../logger';
|
||||
import {
|
||||
CREATE_FEATURE,
|
||||
DELETE_FEATURE,
|
||||
CREATE_FEATURE_STRATEGY,
|
||||
UPDATE_FEATURE,
|
||||
} from '../../../types/permissions';
|
||||
import {
|
||||
@ -75,7 +76,11 @@ export default class ProjectFeaturesController extends Controller {
|
||||
|
||||
// activation strategies
|
||||
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.put(`${PATH_STRATEGY}`, this.updateStrategy, UPDATE_FEATURE);
|
||||
this.patch(`${PATH_STRATEGY}`, this.patchStrategy, UPDATE_FEATURE);
|
||||
|
Loading…
Reference in New Issue
Block a user