@lightdash/cli 0.1961.1 → 0.1961.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -57,7 +57,7 @@ const askPermissionToStoreWarehouseCredentials = async () => {
|
|
57
57
|
};
|
58
58
|
const createProject = async (options) => {
|
59
59
|
// Check permissions before proceeding
|
60
|
-
await (0, apiClient_1.checkProjectCreationPermission)(options.type);
|
60
|
+
await (0, apiClient_1.checkProjectCreationPermission)(options.upstreamProjectUuid, options.type);
|
61
61
|
const dbtVersion = await (0, getDbtVersion_1.getDbtVersion)();
|
62
62
|
const absoluteProjectPath = path_1.default.resolve(options.projectDir);
|
63
63
|
const context = await (0, context_1.getDbtContext)({ projectDir: absoluteProjectPath });
|
@@ -7,6 +7,6 @@ type LightdashApiProps = {
|
|
7
7
|
};
|
8
8
|
export declare const lightdashApi: <T extends ApiResponse["results"]>({ method, url, body, }: LightdashApiProps) => Promise<T>;
|
9
9
|
export declare const getUserContext: () => Promise<LightdashUserWithAbilityRules>;
|
10
|
-
export declare const checkProjectCreationPermission: (projectType: ProjectType) => Promise<void>;
|
10
|
+
export declare const checkProjectCreationPermission: (upstreamProjectUuid: string | undefined, projectType: ProjectType) => Promise<void>;
|
11
11
|
export declare const checkLightdashVersion: () => Promise<void>;
|
12
12
|
export {};
|
@@ -52,14 +52,18 @@ const getUserContext = async () => (0, exports.lightdashApi)({
|
|
52
52
|
body: undefined,
|
53
53
|
});
|
54
54
|
exports.getUserContext = getUserContext;
|
55
|
-
const checkProjectCreationPermission = async (projectType) => {
|
55
|
+
const checkProjectCreationPermission = async (upstreamProjectUuid, projectType) => {
|
56
56
|
try {
|
57
57
|
const user = await (0, exports.getUserContext)();
|
58
58
|
// Build CASL ability from user's ability rules (same as backend)
|
59
59
|
const ability = new ability_1.Ability(user.abilityRules);
|
60
|
+
if (!user.organizationUuid) {
|
61
|
+
throw new common_1.ForbiddenError(`You don't have permission to create projects.`);
|
62
|
+
}
|
60
63
|
// Check if user has permission to create project of the specified type
|
61
64
|
const canCreate = ability.can('create', (0, ability_1.subject)('Project', {
|
62
|
-
organizationUuid: user.organizationUuid
|
65
|
+
organizationUuid: user.organizationUuid,
|
66
|
+
upstreamProjectUuid,
|
63
67
|
type: projectType,
|
64
68
|
}));
|
65
69
|
if (!canCreate) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lightdash/cli",
|
3
|
-
"version": "0.1961.
|
3
|
+
"version": "0.1961.3",
|
4
4
|
"license": "MIT",
|
5
5
|
"bin": {
|
6
6
|
"lightdash": "dist/index.js"
|
@@ -32,8 +32,8 @@
|
|
32
32
|
"parse-node-version": "^2.0.0",
|
33
33
|
"unique-names-generator": "^4.7.1",
|
34
34
|
"uuid": "^11.0.3",
|
35
|
-
"@lightdash/common": "0.1961.
|
36
|
-
"@lightdash/warehouses": "0.1961.
|
35
|
+
"@lightdash/common": "0.1961.3",
|
36
|
+
"@lightdash/warehouses": "0.1961.3"
|
37
37
|
},
|
38
38
|
"description": "Lightdash CLI tool",
|
39
39
|
"devDependencies": {
|