@@ -79,6 +79,18 @@ async function createBodies() {
7979 email : typeLowerCase . replace ( ' ' , '' ) + '@example.com'
8080 } ) ) ;
8181 } ) ;
82+
83+ bodies . push ( await Body . create ( {
84+ name : 'Network Commission' ,
85+ code : 'XNE' ,
86+ description : 'Network Commission' ,
87+ type : 'commission' ,
88+ phone : '1-800-111-11-11' ,
89+ address : 'Somewhere in Europe' ,
90+ founded_at : '1970-01-01' ,
91+ 92+ } ) ) ;
93+
8294 return bodies ;
8395}
8496
@@ -235,6 +247,12 @@ async function createPermissions() {
235247 scope : 'global' ,
236248 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'
237249 } ) ;
250+ permissions . manageAntennaCriteria = await Permission . create ( {
251+ action : 'manage_network' ,
252+ object : 'antenna_criteria' ,
253+ scope : 'global' ,
254+ description : 'Manage the Antenna Criteria fulfilment of Locals'
255+ } ) ;
238256
239257 permissions . members = await Permission . bulkCreate ( [ {
240258 scope : 'global' ,
@@ -444,6 +462,12 @@ async function createPermissions() {
444462 scope : 'local' ,
445463 description : '-'
446464 } ,
465+ {
466+ action : 'manage_network' ,
467+ object : 'boards' ,
468+ scope : 'local' ,
469+ description : 'Manage boards of a local'
470+ }
447471 ] , { individualHooks : true , validate : true } ) ;
448472
449473 permissions . board = [ ...otherBoardPermissions , ...boardPermissions ] ;
@@ -518,9 +542,22 @@ async function createPermissions() {
518542 object : 'join_request' ,
519543 scope : 'global' ,
520544 description : 'View join requests to any body in the system. This could disclose a bigger portion of the members database and thus should be assigned carefully'
521- } ] , { individualHooks : true , validate : true } ) ;
545+ } ,
546+ {
547+ action : 'manage_network' ,
548+ object : 'boards' ,
549+ scope : 'global' ,
550+ description : 'Manage boards of all locals'
551+ } ,
552+ {
553+ action : 'manage_network' ,
554+ object : 'communication' ,
555+ scope : 'global' ,
556+ description : 'Set the fulfilment of the `communication` Antenna Criterion'
557+ }
558+ ] , { individualHooks : true , validate : true } ) ;
522559
523- permissions . netCom = [ ...netComPermissions , permissions . viewMembersCircle , permissions . addMemberCircle ] ;
560+ permissions . netCom = [ ...netComPermissions , permissions . viewMembersCircle , permissions . addMemberCircle , permissions . seeMemberslistsAgora , permissions . manageAntennaCriteria ] ;
524561
525562 const networkDirectorPermissions = await Permission . bulkCreate ( [ {
526563 action : 'view_deleted' ,
@@ -533,11 +570,60 @@ async function createPermissions() {
533570 object : 'agora' ,
534571 scope : 'global' ,
535572 description : 'Update the is_on_memberslist status for applications for Agora. Should be assigned to Network Director.'
573+ } ,
574+ {
575+ action : 'manage_network' ,
576+ object : 'communication_exception' ,
577+ scope : 'global' ,
578+ description : 'Give exceptions to the `communication` Antenna Criterion'
579+ } ,
580+ {
581+ action : 'manage_network' ,
582+ object : 'board_election' ,
583+ scope : 'global' ,
584+ description : 'Set the fulfilment of the `board election` Antenna Criterion'
585+ } ,
586+ {
587+ action : 'manage_network' ,
588+ object : 'members_list' ,
589+ scope : 'global' ,
590+ description : 'Set the fulfilment of the `members list` Antenna Criterion'
591+ } ,
592+ {
593+ action : 'manage_network' ,
594+ object : 'events' ,
595+ scope : 'global' ,
596+ description : 'Set the fulfilment of the `events` Antenna Criterion'
597+ } ,
598+ {
599+ action : 'manage_network' ,
600+ object : 'agora_attendance' ,
601+ scope : 'global' ,
602+ description : 'Set the fulfilment of the `agora attendance` Antenna Criterion'
603+ } ,
604+ {
605+ action : 'manage_network' ,
606+ object : 'development_plan' ,
607+ scope : 'global' ,
608+ description : 'Set the fulfilment of the `development plan` Antenna Criterion'
609+ } ,
610+ {
611+ action : 'manage_network' ,
612+ object : 'fulfilment_report' ,
613+ scope : 'global' ,
614+ description : 'Set the fulfilment of the `fulfilment report` Antenna Criterion'
536615 } ] , { individualHooks : true , validate : true } ) ;
537616
538- permissions . networkDirector = [ ...networkDirectorPermissions , ...permissions . netCom , permissions . seeMemberslistsAgora , permissions . setMemberslistsFeePaidAgora ] ;
617+ permissions . networkDirector = [ ...networkDirectorPermissions , ...permissions . netCom , permissions . setMemberslistsFeePaidAgora ] ;
618+
619+ const financialDirectorPermissions = await Permission . bulkCreate ( [ {
620+ action : 'manage_network' ,
621+ object : 'membership_fee' ,
622+ scope : 'global' ,
623+ description : 'Set the fulfilment of the `membership fee` Antenna Criterion'
624+ } ] , { individualHooks : true , validate : true } ) ;
539625
540- permissions . financialDirector = [ permissions . seeMemberslistsAgora , permissions . setMemberslistsFeePaidAgora ] ;
626+ permissions . financialDirector = [ ... financialDirectorPermissions , permissions . seeMemberslistsAgora , permissions . setMemberslistsFeePaidAgora , permissions . manageAntennaCriteria ] ;
541627
542628 const suctPermissions = await Permission . bulkCreate ( [ {
543629 action : 'edit' ,
@@ -1160,6 +1246,7 @@ async function createPermissions() {
11601246
11611247async function createMembers ( ) {
11621248 const antenna = data . bodies . find ( ( b ) => b . type === 'antenna' ) ;
1249+ const netcom = data . bodies . find ( ( b ) => b . name === 'Network Commission' ) ;
11631250
11641251 const member = await User . create ( {
11651252 first_name : 'A' ,
@@ -1267,13 +1354,66 @@ async function createMembers() {
12671354 active : false
12681355 } ) ;
12691356
1357+ const netcomMember = await User . create ( {
1358+ first_name : 'NetCom' ,
1359+ last_name : 'Member' ,
1360+ username : 'netcom' ,
1361+ 1362+ password : '5ecr3t5ecr3t' ,
1363+ about_me : 'A member of the Network Commission' ,
1364+ date_of_birth : '1970-01-01' ,
1365+ gender : 'neutral' ,
1366+ address : 'Somewhere in Europe' ,
1367+ mail_confirmed_at : new Date ( )
1368+ } ) ;
1369+
1370+ await BodyMembership . create ( {
1371+ body_id : antenna . id ,
1372+ user_id : netcomMember . id
1373+ } ) ;
1374+
1375+ await BodyMembership . create ( {
1376+ body_id : netcom . id ,
1377+ user_id : netcomMember . id
1378+ } ) ;
1379+
1380+ await CircleMembership . create ( {
1381+ circle_id : data . circles . netcomCircle . id ,
1382+ user_id : netcomMember . id
1383+ } ) ;
1384+
1385+ const ndMember = await User . create ( {
1386+ first_name : 'Network' ,
1387+ last_name : 'Director' ,
1388+ username : 'nd' ,
1389+ 1390+ password : '5ecr3t5ecr3t' ,
1391+ about_me : 'The ND of CD' ,
1392+ date_of_birth : '1970-01-01' ,
1393+ gender : 'neutral' ,
1394+ address : 'Somewhere in Europe' ,
1395+ mail_confirmed_at : new Date ( )
1396+ } ) ;
1397+
1398+ await BodyMembership . create ( {
1399+ body_id : antenna . id ,
1400+ user_id : ndMember . id
1401+ } ) ;
1402+
1403+ await CircleMembership . create ( {
1404+ circle_id : data . circles . networkDirectorCircle . id ,
1405+ user_id : ndMember . id
1406+ } ) ;
1407+
12701408 return {
12711409 member,
12721410 boardMember,
12731411 notMember,
12741412 notConfirmedMember,
12751413 passwordResetMember,
1276- suspendedMember
1414+ suspendedMember,
1415+ netcomMember,
1416+ ndMember
12771417 } ;
12781418}
12791419
0 commit comments