Skip to content

Commit dcf352b

Browse files
author
Drahma
committed
HP-2347/Added target manager
1 parent 06ce0af commit dcf352b

File tree

3 files changed

+49
-4
lines changed

3 files changed

+49
-4
lines changed

src/files/items.php

+34
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,15 @@
678678
'role:sale.master',
679679
],
680680
],
681+
'role:target.manager' => [
682+
'type' => 1,
683+
'children' => [
684+
'target.read',
685+
'target.create',
686+
'target.update',
687+
'target.delete',
688+
],
689+
],
681690
'role:part.user' => [
682691
'type' => 1,
683692
'description' => 'The role is generally assigned to users who have access to part information',
@@ -937,6 +946,7 @@
937946
'client.set-tmp-pwd',
938947
'client.notify',
939948
'role:purse.user',
949+
'role:target.manager',
940950
],
941951
],
942952
'role:reseller' => [
@@ -2474,6 +2484,30 @@
24742484
'type' => 2,
24752485
'description' => 'Prohibits creating of the sale',
24762486
],
2487+
'target.read' => [
2488+
'type' => 2,
2489+
],
2490+
'deny:target.read' => [
2491+
'type' => 2,
2492+
],
2493+
'target.create' => [
2494+
'type' => 2,
2495+
],
2496+
'deny:target.create' => [
2497+
'type' => 2,
2498+
],
2499+
'target.update' => [
2500+
'type' => 2,
2501+
],
2502+
'deny:target.update' => [
2503+
'type' => 2,
2504+
],
2505+
'target.delete' => [
2506+
'type' => 2,
2507+
],
2508+
'deny:target.delete' => [
2509+
'type' => 2,
2510+
],
24772511
'part.read' => [
24782512
'type' => 2,
24792513
'description' => 'Allows reading of the part',

src/files/source/tree.php

+7
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,12 @@
275275
'role:document.manager',
276276
'role:sale.master',
277277
],
278+
'role:target.manager' => [
279+
'target.read',
280+
'target.create',
281+
'target.update',
282+
'target.delete',
283+
],
278284
// STOCK MODULE
279285
'role:part.user' => [
280286
'part.read',
@@ -414,6 +420,7 @@
414420
'mailing.prepare', 'mailing.send',
415421
'client.set-tmp-pwd', 'client.notify',
416422
'role:purse.user',
423+
'role:target.manager',
417424
],
418425
'role:reseller' => [
419426
'have-goods',

tests/unit/CheckAccessTrait.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,8 @@ public function testAccounter()
292292
'purse.set-credit','server.read-wizzard','server.read-legend', 'server.read-financial-info',
293293
'server.read-billing','plan.set-note',
294294
'client.read-financial-info', 'client.read-requisite', 'client.read-referral', 'client.read-deleted', 'client.read-ip',
295-
'ticket.read-templates', 'ticket.read-statistics', 'ticket.set-private', 'ticket.set-recipient', 'ticket.set-time'
295+
'ticket.read-templates', 'ticket.read-statistics', 'ticket.set-private', 'ticket.set-recipient', 'ticket.set-time',
296+
'target.read', 'target.create', 'target.update', 'target.delete',
296297
]);
297298
}
298299

@@ -336,7 +337,8 @@ public function testManager()
336337
'purse.set-credit','server.read-wizzard','server.read-legend','server.read-financial-info',
337338
'server.read-billing','plan.set-note',
338339
'client.read-financial-info', 'client.read-requisite', 'client.read-referral', 'client.read-deleted', 'client.read-ip',
339-
'ticket.read-templates', 'ticket.read-statistics', 'ticket.set-private', 'ticket.set-recipient', 'ticket.set-time'
340+
'ticket.read-templates', 'ticket.read-statistics', 'ticket.set-private', 'ticket.set-recipient', 'ticket.set-time',
341+
'target.read', 'target.create', 'target.update', 'target.delete',
340342

341343
]);
342344
}
@@ -381,8 +383,8 @@ public function testReseller()
381383
'purse.set-credit','server.read-wizzard','server.read-legend','server.read-financial-info',
382384
'server.read-billing', 'plan.set-note',
383385
'client.read-financial-info', 'client.read-requisite', 'client.read-referral', 'client.read-deleted', 'client.read-ip',
384-
'ticket.read-templates', 'ticket.read-statistics', 'ticket.set-private', 'ticket.set-recipient', 'ticket.set-time'
385-
386+
'ticket.read-templates', 'ticket.read-statistics', 'ticket.set-private', 'ticket.set-recipient', 'ticket.set-time',
387+
'target.read', 'target.create', 'target.update', 'target.delete',
386388
]);
387389
}
388390

@@ -458,6 +460,7 @@ public function testMighty()
458460
'client.read-financial-info', 'client.read-requisite', 'client.read-referral', 'client.read-deleted', 'client.read-ip',
459461
'part.read-administrative', 'ticket.read-templates', 'ticket.read-statistics', 'ticket.set-private', 'ticket.set-recipient', 'ticket.set-time',
460462
'see-no-mans',
463+
'target.read', 'target.create', 'target.update', 'target.delete',
461464
]);
462465
}
463466

@@ -532,6 +535,7 @@ public function testAlmighty()
532535
'part.read-administrative', 'ticket.read-templates', 'ticket.read-statistics', 'ticket.set-private', 'ticket.set-recipient', 'ticket.set-time',
533536

534537
'see-no-mans', 'bill.charges.read', 'bill.see-server-charges',
538+
'target.read', 'target.create', 'target.update', 'target.delete',
535539
]);
536540
}
537541

0 commit comments

Comments
 (0)