Skip to content

Commit

Permalink
fix(assetsGroups): disable checkRights on impersonate (#325)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebtiz13 committed Jan 9, 2024
1 parent 5f87787 commit eaa3edc
Show file tree
Hide file tree
Showing 3 changed files with 565 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/modules/asset/AssetsGroupsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class AssetsGroupsController {
private get as() {
return (user: User | null): EmbeddedSDK => {
if (user?._id) {
return this.sdk.as(user, { checkRights: true });
return this.sdk.as(user, { checkRights: false });
}
return this.sdk;
};
Expand Down
81 changes: 81 additions & 0 deletions tests/fixtures/rights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,86 @@ export default {
},
},
},
"ayse-admin": {
content: {
profileIds: ["ayse-admin"],
},
credentials: {
local: {
username: "ayse-admin",
password: "password",
},
},
},
},
profiles: {
"ayse-admin": {
rateLimit: 0,
policies: [
{
roleId: "tests",
},
{
roleId: "assets.admin",
restrictedTo: [
{
index: "engine-ayse",
},
],
},
{
roleId: "devices.admin",
restrictedTo: [
{
index: "engine-ayse",
},
],
},
{
roleId: "assetsGroup.admin",
restrictedTo: [
{
index: "engine-ayse",
},
],
},
],
optimizedPolicies: [
{
roleId: "assets.admin",
restrictedTo: {},
},
{
roleId: "devices.admin",
restrictedTo: {},
},
{
roleId: "assetsGroup.admin",
restrictedTo: {},
},
],
},
},
roles: {
tests: {
controllers: {
admin: {
actions: {
loadFixtures: true,
},
},
collection: {
actions: {
refresh: true,
},
},
document: {
actions: {
get: true,
deleteByQuery: true,
},
},
},
},
},
};
Loading

0 comments on commit eaa3edc

Please sign in to comment.