-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(roles): add specific roles for assets and devices (#365)
* ci(doc): fix major version in CI doc step * feat(roles): add new specific roles for assets and devices * refactor(asset roles): removed roleAssetDeviceAssociation as it was a duplicate of device role * fix(roles): Move update right from creation role to configuration role as it updates only metadata * Update lib/modules/device/roles/specificRoles/RoleDevicesAssetAssociation.ts typo Co-authored-by: Ricky <[email protected]> * Update lib/modules/device/roles/specificRoles/RoleDevicesConfiguration.ts typo Co-authored-by: Ricky <[email protected]> --------- Co-authored-by: Florian Maunier <[email protected]> Co-authored-by: Ricky <[email protected]>
- Loading branch information
1 parent
8a14207
commit a01982c
Showing
12 changed files
with
183 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
lib/modules/asset/roles/specificRoles/RoleAssetsConfiguration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { KuzzleRole } from "../../../shared/types/KuzzleRole"; | ||
|
||
/** | ||
* This role allows to configurate an asset metadata. | ||
* | ||
* It's a tenant role. | ||
* | ||
*/ | ||
export const RoleAssetsConfiguration: KuzzleRole = { | ||
definition: { | ||
controllers: { | ||
"device-manager/assets": { | ||
actions: { replaceMetadata: true, update: true }, | ||
}, | ||
}, | ||
}, | ||
name: "assets.configuration", | ||
}; |
22 changes: 22 additions & 0 deletions
22
lib/modules/asset/roles/specificRoles/RoleAssetsCreation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { KuzzleRole } from "../../../shared/types/KuzzleRole"; | ||
|
||
/** | ||
* This role allows to create, update and delete an asset. | ||
* | ||
* It's a tenant role. | ||
* | ||
*/ | ||
export const RoleAssetsCreation: KuzzleRole = { | ||
definition: { | ||
controllers: { | ||
"device-manager/assets": { | ||
actions: { | ||
create: true, | ||
delete: true, | ||
upsert: true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
name: "assets.creation", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./RoleAssetsConfiguration"; | ||
export * from "./RoleAssetsCreation"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
lib/modules/device/roles/specificRoles/RoleDevicesAssetAssociation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { KuzzleRole } from "../../../shared/types/KuzzleRole"; | ||
|
||
/** | ||
* This role allows to associate assets and devices. | ||
* | ||
* It's a tenant role. | ||
* | ||
*/ | ||
export const RoleDevicesAssetAssociation: KuzzleRole = { | ||
definition: { | ||
controllers: { | ||
"device-manager/devices": { | ||
actions: { linkAsset: true, unlinkAsset: true }, | ||
}, | ||
}, | ||
}, | ||
name: "devices.assetAssociation", | ||
}; |
18 changes: 18 additions & 0 deletions
18
lib/modules/device/roles/specificRoles/RoleDevicesConfiguration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { KuzzleRole } from "../../../shared/types/KuzzleRole"; | ||
|
||
/** | ||
* This role allows to configure a device metadata. | ||
* | ||
* It's a tenant role. | ||
* | ||
*/ | ||
export const RoleDevicesConfiguration: KuzzleRole = { | ||
definition: { | ||
controllers: { | ||
"device-manager/devices": { | ||
actions: { replaceMetadata: true, update: true }, | ||
}, | ||
}, | ||
}, | ||
name: "devices.configuration", | ||
}; |
22 changes: 22 additions & 0 deletions
22
lib/modules/device/roles/specificRoles/RoleDevicesCreation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { KuzzleRole } from "../../../shared/types/KuzzleRole"; | ||
|
||
/** | ||
* This role allows to create, update and delete a device. | ||
* | ||
* It's a tenant role. | ||
* | ||
*/ | ||
export const RoleDevicesCreation: KuzzleRole = { | ||
definition: { | ||
controllers: { | ||
"device-manager/devices": { | ||
actions: { | ||
create: true, | ||
delete: true, | ||
upsert: true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
name: "devices.creation", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from "./RoleDevicesAssetAssociation"; | ||
export * from "./RoleDevicesConfiguration"; | ||
export * from "./RoleDevicesCreation"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters