@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | { |
56 | 56 | //Read the permission config file... |
57 | 57 | $config = Yaml::parse( |
58 | - file_get_contents(__DIR__ . '/../../config/permissions.yaml') |
|
58 | + file_get_contents(__DIR__.'/../../config/permissions.yaml') |
|
59 | 59 | ); |
60 | 60 | |
61 | 61 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | } |
122 | 122 | |
123 | 123 | $parent = $user->getGroup(); |
124 | - while($parent != null){ //The top group, has parent == null |
|
124 | + while ($parent != null) { //The top group, has parent == null |
|
125 | 125 | //Check if our current element gives a info about disallow/allow |
126 | 126 | $allowed = $this->dontInherit($parent, $permission, $operation); |
127 | 127 | if ($allowed !== null) { |
@@ -73,7 +73,7 @@ |
||
73 | 73 | */ |
74 | 74 | public function getIDString(): string |
75 | 75 | { |
76 | - return 'G' . sprintf('%06d', $this->getID()); |
|
76 | + return 'G'.sprintf('%06d', $this->getID()); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | public function getPermissions(): PermissionsEmbed |
@@ -63,7 +63,7 @@ |
||
63 | 63 | // if the user is anonymous, we use the anonymous user. |
64 | 64 | if (!$user instanceof User) { |
65 | 65 | $user = $this->entityManager->find(User::class, User::ID_ANONYMOUS); |
66 | - if($user === null) { |
|
66 | + if ($user === null) { |
|
67 | 67 | return false; |
68 | 68 | } |
69 | 69 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | protected function supports($attribute, $subject) |
49 | 49 | { |
50 | - if($subject instanceof User) |
|
50 | + if ($subject instanceof User) |
|
51 | 51 | { |
52 | 52 | return in_array($attribute, array_merge( |
53 | 53 | $this->resolver->listOperationsForPermission('users'), |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | */ |
70 | 70 | protected function voteOnUser($attribute, $subject, User $user): bool |
71 | 71 | { |
72 | - if($subject instanceof User) |
|
72 | + if ($subject instanceof User) |
|
73 | 73 | { |
74 | 74 | //Check if the checked user is the user itself |
75 | - if($subject->getID() === $user->getID() && |
|
75 | + if ($subject->getID() === $user->getID() && |
|
76 | 76 | $this->resolver->isValidOperation('self', $attribute)) { |
77 | 77 | //Then we also need to check the self permission |
78 | 78 | $tmp = $this->resolver->inherit($user, 'self', $attribute) ?? false; |
79 | 79 | //But if the self value is not allowed then use just the user value: |
80 | - if($tmp) |
|
80 | + if ($tmp) |
|
81 | 81 | return $tmp; |
82 | 82 | } |
83 | 83 | //Else just check users permission: |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | |
35 | 35 | //Check if a sub permission should be checked -> $attribute has format name.edit |
36 | - if(strpos($attribute, '.') !== false) { |
|
36 | + if (strpos($attribute, '.') !== false) { |
|
37 | 37 | [$perm, $op] = explode('.', $attribute); |
38 | 38 | return in_array($op, $this->resolver->listOperationsForPermission('parts_'.$perm), false); |
39 | 39 | } |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | |
49 | 49 | protected function voteOnUser($attribute, $subject, User $user): bool |
50 | 50 | { |
51 | - if($subject instanceof Part) { |
|
51 | + if ($subject instanceof Part) { |
|
52 | 52 | |
53 | 53 | //Check for sub permissions |
54 | - if(strpos($attribute, '.') !== false) { |
|
54 | + if (strpos($attribute, '.') !== false) { |
|
55 | 55 | [$perm, $op] = explode('.', $attribute); |
56 | - return $this->resolver->inherit($user, 'parts_'. $perm, $op) ?? false; |
|
56 | + return $this->resolver->inherit($user, 'parts_'.$perm, $op) ?? false; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | //Null concealing operator means, that no |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $em->persist($new_part); |
118 | 118 | $em->flush(); |
119 | 119 | $this->addFlash('success', $translator->trans('part.created_flash')); |
120 | - return $this->redirectToRoute('part_edit',['id' => $new_part->getID()]); |
|
120 | + return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $em->persist($new_part); |
149 | 149 | $em->flush(); |
150 | 150 | $this->addFlash('success', $translator->trans('part.created_flash')); |
151 | - return $this->redirectToRoute('part_edit',['id' => $new_part->getID()]); |
|
151 | + return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function infoURL($entity) : string |
62 | 62 | { |
63 | - if($entity instanceof Part) |
|
63 | + if ($entity instanceof Part) |
|
64 | 64 | { |
65 | 65 | return $this->urlGenerator->generate('part_info', ['id' => $entity->getID()]); |
66 | 66 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | public function editURL($entity) : string |
73 | 73 | { |
74 | - if($entity instanceof Part) |
|
74 | + if ($entity instanceof Part) |
|
75 | 75 | { |
76 | 76 | return $this->urlGenerator->generate('part_edit', ['id' => $entity->getID()]); |
77 | 77 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | public function createURL($entity) : string |
84 | 84 | { |
85 | - if($entity instanceof Part) |
|
85 | + if ($entity instanceof Part) |
|
86 | 86 | { |
87 | 87 | return $this->urlGenerator->generate('part_new'); |
88 | 88 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | public function cloneURL($entity) : string |
94 | 94 | { |
95 | - if($entity instanceof Part) |
|
95 | + if ($entity instanceof Part) |
|
96 | 96 | { |
97 | 97 | return $this->urlGenerator->generate('part_clone', ['id' => $entity->getID()]); |
98 | 98 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | { |
112 | 112 | $href = $this->infoURL($entity); |
113 | 113 | |
114 | - if($entity instanceof NamedDBElement) |
|
114 | + if ($entity instanceof NamedDBElement) |
|
115 | 115 | { |
116 | 116 | return sprintf('<a href="%s">%s</a>', $href, $entity->getName()); |
117 | 117 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $user = $users[0]; |
51 | 51 | |
52 | 52 | |
53 | - if($user == null) |
|
53 | + if ($user == null) |
|
54 | 54 | { |
55 | 55 | $io->error(sprintf('No user with the given username %s found in the database!', $user_name)); |
56 | 56 | return; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | sprintf('You are going to change the password of %s with ID %d. Proceed?', |
63 | 63 | $user->getFullName(true), $user->getID())); |
64 | 64 | |
65 | - if(!$proceed) |
|
65 | + if (!$proceed) |
|
66 | 66 | { |
67 | 67 | return; |
68 | 68 | } |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | $success = false; |
71 | 71 | $new_password = ""; |
72 | 72 | |
73 | - while(!$success) { |
|
73 | + while (!$success) { |
|
74 | 74 | $pw1 = $io->askHidden("Please enter new password:"); |
75 | 75 | $pw2 = $io->askHidden('Please confirm:'); |
76 | - if($pw1 !== $pw2) { |
|
76 | + if ($pw1 !== $pw2) { |
|
77 | 77 | $io->error('The entered password did not match! Please try again.'); |
78 | 78 | } else { |
79 | 79 | //Exit loop |
@@ -74,16 +74,16 @@ discard block |
||
74 | 74 | |
75 | 75 | public function getReadOperationName() : string |
76 | 76 | { |
77 | - if($this->prefix !== '') { |
|
78 | - return $this->prefix . '.' . $this->read; |
|
77 | + if ($this->prefix !== '') { |
|
78 | + return $this->prefix.'.'.$this->read; |
|
79 | 79 | } |
80 | 80 | return $this->read; |
81 | 81 | } |
82 | 82 | |
83 | 83 | public function getEditOperationName() : string |
84 | 84 | { |
85 | - if($this->prefix !== '') { |
|
86 | - return $this->prefix . '.' . $this->edit; |
|
85 | + if ($this->prefix !== '') { |
|
86 | + return $this->prefix.'.'.$this->edit; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | return $this->edit; |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | |
92 | 92 | public function getPlaceholder() |
93 | 93 | { |
94 | - if($this->placeholder === null) |
|
94 | + if ($this->placeholder === null) |
|
95 | 95 | { |
96 | - switch($this->type) |
|
96 | + switch ($this->type) |
|
97 | 97 | { |
98 | 98 | case 'integer': |
99 | 99 | return 0; |