Issues (789)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

app/services/SkautIS/UserService.php (11 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace App\Services\SkautIS;
4
5
/**
6
 * User service
7
 */
8
class UserService extends SkautisService
9
{
10
11
	/**
12
	 * Returns Role ID of logged user
13
	 *
14
	 * @param   void
15
	 * @return  type
16
	 */
17
	public function getRoleId()
18
	{
19
		return $this->getSkautis()->getRoleId();
0 ignored issues
show
The method getRoleId() does not seem to exist on object<Skautis\Skautis>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
20
	}
21
22
23
	/**
24
	 * Returns all SkautIS roles
25
	 *
26
	 * @param   bool   $activeOnly  only active roles
27
	 * @return  array               all roles of logged user
28
	 */
29
	public function getAllSkautISRoles($activeOnly = true)
30
	{
31
		return $this->getSkautis()
0 ignored issues
show
The method UserRoleAll() does not seem to exist on object<Skautis\User>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
32
			->user
33
			->UserRoleAll([
34
				'ID_User'  => $this->getUserDetail()->ID,
35
				'IsActive' => $activeOnly,
36
			]);
37
	}
38
39
40
	/**
41
	 * Gets user detail
42
	 *
43
	 * @param   void
44
	 * @return  res
45
	 */
46
	public function getUserDetail()
47
	{
48
		$id = __FUNCTION__;
49
		// cache by the request
50
		if (!($res = $this->load($id))) {
51
			$res = $this->save($id, $this->getSkautis()->user->UserDetail());
0 ignored issues
show
The method UserDetail() does not seem to exist on object<Skautis\User>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
52
		}
53
		return $res;
54
	}
55
56
57
	/**
58
	 * Changes the loggeed user SkautIS role
59
	 *
60
	 * @param   ID_Role  $id
61
	 * @return  void
62
	 */
63
	public function updateSkautISRole($id)
64
	{
65
		$skautis = $this->getSkautis();
66
67
		$unitId = $this->getSkautis()
0 ignored issues
show
The method LoginUpdate() does not seem to exist on object<Skautis\User>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
68
			->user
69
			->LoginUpdate([
70
				'ID_UserRole' => $id,
71
				'ID'          => $skautis->getToken(),
0 ignored issues
show
The method getToken() does not seem to exist on object<Skautis\Skautis>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
72
			]);
73
74
		if ($unitId) {
75
			$skautis->setRoleId($id);
0 ignored issues
show
The method setRoleId() does not seem to exist on object<Skautis\Skautis>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
76
			$skautis->setUnitId($unitId->ID_Unit);
0 ignored issues
show
The method setUnitId() does not seem to exist on object<Skautis\Skautis>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
77
		}
78
	}
79
80
81
	/**
82
	 * Returns complete list of information about logged user
83
	 *
84
	 * @param   void
85
	 * @return  type
86
	 */
87
	public function getPersonalDetail($personId = null)
88
	{
89
		if(!$personId) {
90
			$personId = $this->getUserDetail()->ID_Person;
91
		}
92
93
		return $this->getSkautis()->org->personDetail((["ID" => $personId]));
94
	}
95
96
	/**
97
	 * Returns complete list of information about logged user unit
98
	 *
99
	 * @param   void
100
	 * @return  type
101
	 */
102
	public function getParentUnitDetail($unitId)
103
	{
104
		return $this->getSkautis()->org->unitAll((["ID_UnitChild" => $unitId]));
105
	}
106
107
	/**
108
	 * Returns complete list of information about logged user unit
109
	 *
110
	 * @param   void
111
	 * @return  type
112
	 */
113
	public function getUnitDetail($unitId)
114
	{
115
		return $this->getSkautis()->org->unitDetail((["ID" => $unitId]));
116
	}
117
118
	/**
119
	 * Returns complete list of information about logged user unit
120
	 *
121
	 * @param   void
122
	 * @return  type
123
	 */
124
	public function getPersonUnitDetail($personId)
125
	{
126
		$membership = $this->getSkautis()
127
			->org
128
			->membershipAllPerson(([
129
				'ID_Person'         => $personId,
130
				'ID_MembershipType' => 'radne'
131
			]));
132
133
		return $membership->MembershipAllOutput;
134
	}
135
136
	/**
137
	 * Check if login session is still valid
138
	 *
139
	 * @param   void
140
	 * @return  type
141
	 */
142
	public function isLoggedIn()
143
	{
144
		return $this->getSkautis()->getUser()->isLoggedIn();
145
	}
146
147
148
	/**
149
	 * Resets login data
150
	 *
151
	 * @param   void
152
	 * @return  void
153
	 */
154
	public function resetLoginData()
155
	{
156
		$this->getSkautis()->resetLoginData();
0 ignored issues
show
The method resetLoginData() does not exist on Skautis\Skautis. Did you maybe mean setLoginData()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
157
	}
158
159
160
	/**
161
	 * Verify action
162
	 *
163
	 * @param   type  $table      např. ID_EventGeneral, NULL = oveření nad celou tabulkou
164
	 * @param   type  $id         id ověřované akce - např EV_EventGeneral_UPDATE
165
	 * @param   type  $ID_Action  tabulka v DB skautisu
166
	 * @return  BOOL|stdClass|array
167
	 */
168
	public function actionVerify($table, $id = NULL, $ID_Action = NULL)
0 ignored issues
show
Coding Style Naming introduced by
The parameter $ID_Action is not named in camelCase.

This check marks parameter names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
169
	{
170
		$res = $this->getSkautis()->user->ActionVerify([
0 ignored issues
show
The method ActionVerify() does not seem to exist on object<Skautis\User>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
171
			'ID'        => $id,
172
			'ID_Table'  => $table,
173
			'ID_Action' => $ID_Action,
174
		]);
175
176
		// returns boolean if certain function for verifying is set
177
		if ($ID_Action !== NULL) {
178
			if ($res instanceof stdClass) {
0 ignored issues
show
The class App\Services\SkautIS\stdClass does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
179
				return false;
180
			}
181
			if (is_array($res)) {
182
				return true;
183
			}
184
		}
185
		if (is_array($res)) {
186
			$tmp = array();
187
			foreach ($res as $v) {
188
				$tmp[$v->ID] = $v;
189
			}
190
			return $tmp;
191
		}
192
		return $res;
193
	}
194
195
}
196