Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(network): update seeder for network module #972

Merged
merged 5 commits into from
Sep 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions scripts/seed.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async function createBodies() {
name: 'Network Commission',
code: 'XNE',
description: 'Network Commission',
type: 'Commission',
type: 'commission',
phone: '1-800-111-11-11',
address: 'Somewhere in Europe',
founded_at: '1970-01-01',
Expand Down Expand Up @@ -247,6 +247,12 @@ async function createPermissions() {
scope: 'global',
description: 'Add anyone to any circle in the system, no matter if the circle is joinable or not but still respecting that bound circles can only hold members of the same body. This also allows to add yourself to any circle and thus can be used for a privilege escalation'
});
permissions.manageAntennaCritera = await Permission.create({
LeonVreling marked this conversation as resolved.
Show resolved Hide resolved
action: 'manage_network',
object: 'antenna_criteria',
scope: 'global',
description: 'Manage the Antenna Criteria fulfilment of Locals'
});

permissions.members = await Permission.bulkCreate([{
scope: 'global',
Expand Down Expand Up @@ -543,12 +549,6 @@ async function createPermissions() {
scope: 'global',
description: 'Manage boards of all locals'
},
{
action: 'manage_network',
object: 'antenna_criteria',
scope: 'global',
description: 'Manage the Antenna Criteria fulfilment of Locals'
},
{
action: 'manage_network',
object: 'communication',
Expand All @@ -557,7 +557,7 @@ async function createPermissions() {
}
], { individualHooks: true, validate: true });

permissions.netCom = [...netComPermissions, permissions.viewMembersCircle, permissions.addMemberCircle];
permissions.netCom = [...netComPermissions, permissions.viewMembersCircle, permissions.addMemberCircle, permissions.seeMemberslistsAgora, permissions.manageAntennaCritera];

const networkDirectorPermissions = await Permission.bulkCreate([{
action: 'view_deleted',
Expand Down Expand Up @@ -617,19 +617,13 @@ async function createPermissions() {
permissions.networkDirector = [...networkDirectorPermissions, ...permissions.netCom, permissions.seeMemberslistsAgora, permissions.setMemberslistsFeePaidAgora];
LeonVreling marked this conversation as resolved.
Show resolved Hide resolved

const financialDirectorPermissions = await Permission.bulkCreate([{
action: 'manage_network',
object: 'antenna_criteria',
scope: 'global',
description: 'Manage the Antenna Criteria fulfilment of Locals'
},
{
action: 'manage_network',
object: 'membership_fee',
scope: 'global',
description: 'Set the fulfilment of the `membership fee` Antenna Criterion'
}], { individualHooks: true, validate: true });

permissions.financialDirector = [...financialDirectorPermissions, permissions.seeMemberslistsAgora, permissions.setMemberslistsFeePaidAgora];
permissions.financialDirector = [...financialDirectorPermissions, permissions.seeMemberslistsAgora, permissions.setMemberslistsFeePaidAgora, permissions.manageAntennaCritera];

const suctPermissions = await Permission.bulkCreate([{
action: 'edit',
Expand Down Expand Up @@ -1373,6 +1367,11 @@ async function createMembers() {
mail_confirmed_at: new Date()
});

await BodyMembership.create({
body_id: antenna.id,
user_id: netcomMember.id
});

await BodyMembership.create({
body_id: netcom.id,
user_id: netcomMember.id
Expand All @@ -1396,6 +1395,11 @@ async function createMembers() {
mail_confirmed_at: new Date()
});

await BodyMembership.create({
body_id: antenna.id,
user_id: ndMember.id
});

await CircleMembership.create({
circle_id: data.circles.networkDirectorCircle.id,
user_id: ndMember.id
Expand Down