Skip to content

Commit

Permalink
add scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
sogehige committed Jun 19, 2024
1 parent 3a05490 commit 3b4e2a5
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ describe('#5583 - If lower permission allows, then it should be allowed - @func1
isWaterfallAllowed: true,
order: 0,
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
await AppDataSource.getRepository(Permissions).insert({
Expand All @@ -40,7 +41,8 @@ describe('#5583 - If lower permission allows, then it should be allowed - @func1
isWaterfallAllowed: true,
order: 1,
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
await AppDataSource.getRepository(Permissions).insert({
Expand All @@ -51,7 +53,8 @@ describe('#5583 - If lower permission allows, then it should be allowed - @func1
isWaterfallAllowed: true,
order: 2,
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
await AppDataSource.getRepository(Permissions).insert({
Expand All @@ -62,7 +65,8 @@ describe('#5583 - If lower permission allows, then it should be allowed - @func1
isWaterfallAllowed: true,
order: 3,
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
await AppDataSource.getRepository(Permissions).insert({
Expand All @@ -73,7 +77,8 @@ describe('#5583 - If lower permission allows, then it should be allowed - @func1
isWaterfallAllowed: true,
order: 4,
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
});
Expand All @@ -97,7 +102,8 @@ describe('#5583 - If lower permission allows, then it should be allowed - @func1
isWaterfallAllowed: true,
order: 0,
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
moderation.__permission_based__cLinksEnabled[defaultPermissions.CASTERS] = true;
Expand All @@ -110,7 +116,8 @@ describe('#5583 - If lower permission allows, then it should be allowed - @func1
isWaterfallAllowed: true,
order: 1,
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
moderation.__permission_based__cLinksEnabled[defaultPermissions.MODERATORS] = true;
Expand All @@ -122,7 +129,8 @@ describe('#5583 - If lower permission allows, then it should be allowed - @func1
isWaterfallAllowed: true,
order: 2,
userIds: [user.viewer.userId],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
await AppDataSource.getRepository(Permissions).insert({
Expand All @@ -133,7 +141,8 @@ describe('#5583 - If lower permission allows, then it should be allowed - @func1
isWaterfallAllowed: true,
order: 2,
userIds: [user.viewer.userId],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
await AppDataSource.getRepository(Permissions).insert({
Expand All @@ -144,7 +153,8 @@ describe('#5583 - If lower permission allows, then it should be allowed - @func1
isWaterfallAllowed: true,
order: 3,
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
moderation.__permission_based__cLinksEnabled[defaultPermissions.SUBSCRIBERS] = true;
Expand All @@ -157,7 +167,8 @@ describe('#5583 - If lower permission allows, then it should be allowed - @func1
isWaterfallAllowed: true,
order: 4,
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
moderation.__permission_based__cLinksEnabled[defaultPermissions.VIP] = true;
Expand All @@ -170,7 +181,8 @@ describe('#5583 - If lower permission allows, then it should be allowed - @func1
isWaterfallAllowed: true,
order: 5,
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
moderation.__permission_based__cLinksEnabled[defaultPermissions.VIEWERS] = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ describe('discord#868236481406324747 - Manually included users with link disable
isWaterfallAllowed: true,
order: 0,
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
await AppDataSource.getRepository(Permissions).insert({
Expand All @@ -39,7 +40,8 @@ describe('discord#868236481406324747 - Manually included users with link disable
isWaterfallAllowed: true,
order: 1,
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
await AppDataSource.getRepository(Permissions).insert({
Expand All @@ -50,7 +52,8 @@ describe('discord#868236481406324747 - Manually included users with link disable
isWaterfallAllowed: true,
order: 2,
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
await AppDataSource.getRepository(Permissions).insert({
Expand All @@ -61,7 +64,8 @@ describe('discord#868236481406324747 - Manually included users with link disable
isWaterfallAllowed: true,
order: 3,
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
await AppDataSource.getRepository(Permissions).insert({
Expand All @@ -72,7 +76,8 @@ describe('discord#868236481406324747 - Manually included users with link disable
isWaterfallAllowed: true,
order: 4,
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
});
Expand All @@ -96,7 +101,8 @@ describe('discord#868236481406324747 - Manually included users with link disable
isWaterfallAllowed: true,
order: 0,
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
moderation.__permission_based__cLinksEnabled[defaultPermissions.CASTERS] = true;
Expand All @@ -109,7 +115,8 @@ describe('discord#868236481406324747 - Manually included users with link disable
isWaterfallAllowed: true,
order: 1,
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
moderation.__permission_based__cLinksEnabled[defaultPermissions.MODERATORS] = true;
Expand All @@ -121,7 +128,8 @@ describe('discord#868236481406324747 - Manually included users with link disable
isWaterfallAllowed: true,
order: 2,
userIds: [user.viewer.userId],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
await AppDataSource.getRepository(Permissions).insert({
Expand All @@ -132,7 +140,8 @@ describe('discord#868236481406324747 - Manually included users with link disable
isWaterfallAllowed: true,
order: 3,
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
moderation.__permission_based__cLinksEnabled[defaultPermissions.SUBSCRIBERS] = true;
Expand All @@ -145,7 +154,8 @@ describe('discord#868236481406324747 - Manually included users with link disable
isWaterfallAllowed: true,
order: 4,
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
moderation.__permission_based__cLinksEnabled[defaultPermissions.VIP] = true;
Expand All @@ -158,7 +168,8 @@ describe('discord#868236481406324747 - Manually included users with link disable
isWaterfallAllowed: true,
order: 5,
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
moderation.__permission_based__cLinksEnabled[defaultPermissions.VIEWERS] = true;
Expand Down
33 changes: 22 additions & 11 deletions test/tests/permissions/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ describe('Permissions - check() - @func1', () => {
isWaterfallAllowed: false,
automation: 'none',
userIds: [6],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [],
});
});
Expand Down Expand Up @@ -146,7 +147,8 @@ describe('Permissions - check() - @func1', () => {
isWaterfallAllowed: false,
automation: 'viewers',
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [{
comparator: '==', type: 'points', value: 100,
}],
Expand Down Expand Up @@ -181,7 +183,8 @@ describe('Permissions - check() - @func1', () => {
isWaterfallAllowed: false,
automation: 'viewers',
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [{
comparator: '==', type: 'watched', value: 100,
}],
Expand Down Expand Up @@ -216,7 +219,8 @@ describe('Permissions - check() - @func1', () => {
isWaterfallAllowed: false,
automation: 'viewers',
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [{
comparator: '>=', type: 'tips', value: 100,
}],
Expand Down Expand Up @@ -251,7 +255,8 @@ describe('Permissions - check() - @func1', () => {
isWaterfallAllowed: false,
automation: 'viewers',
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [{
comparator: '>=', type: 'bits', value: 100,
}],
Expand Down Expand Up @@ -286,7 +291,8 @@ describe('Permissions - check() - @func1', () => {
isWaterfallAllowed: false,
automation: 'viewers',
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [{
comparator: '>=', type: 'messages', value: 100,
}],
Expand Down Expand Up @@ -321,7 +327,8 @@ describe('Permissions - check() - @func1', () => {
isWaterfallAllowed: false,
automation: 'viewers',
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [{
comparator: '>=', type: 'subtier', value: 2,
}],
Expand Down Expand Up @@ -356,7 +363,8 @@ describe('Permissions - check() - @func1', () => {
isWaterfallAllowed: false,
automation: 'viewers',
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [{
comparator: '>=', type: 'subcumulativemonths', value: 2,
}],
Expand Down Expand Up @@ -391,7 +399,8 @@ describe('Permissions - check() - @func1', () => {
isWaterfallAllowed: false,
automation: 'viewers',
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [{
comparator: '>=', type: 'substreakmonths', value: 2,
}],
Expand Down Expand Up @@ -426,7 +435,8 @@ describe('Permissions - check() - @func1', () => {
isWaterfallAllowed: false,
automation: 'viewers',
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [{
comparator: '==', type: 'ranks', value: 'Lorem Ipsum',
}],
Expand Down Expand Up @@ -461,7 +471,8 @@ describe('Permissions - check() - @func1', () => {
isWaterfallAllowed: false,
automation: 'viewers',
userIds: [],
excludeUserIds: [],
scopes: [],
excludeUserIds: [],
filters: [{
comparator: '==', type: 'level', value: 5,
}],
Expand Down

0 comments on commit 3b4e2a5

Please sign in to comment.