SecurityHelper   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 7
dl 0
loc 39
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
B authorizeWrite() 0 32 6
A authorizeRead() 0 1 1
1
<?php
2
3
/*
4
 * All Security Checks  are implented using this helper file
5
 */
6
7
use LaravelRealtimeChat\Repositories\Team\DbTeamRepository;
8
class SecurityHelper  {
9
        
10
         
11
public static function authorizeWrite($type) {
12
        switch ($type) {
13
                case "create_project":
14
                        if (Session::get('role'))
15
                                return "allowed";
16
                        else
17
                                return "notAllowed";
18
                        break;
19
                case "create_task":
20
                        if (Session::get('role'))
21
                        {
22
                                /**
23
                                 * Cross check 
24
                                 */
25
                                $teamRepository = new DbTeamRepository();
26
                                $teamId=  \Input::get("teamId");
0 ignored issues
show
Bug introduced by
The type Input was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
27
                                  $id = $teamRepository->getTeamDecodedId($teamId);
28
                                 $teamId=$id;
29
                                $projectId=\Input::get("projectId");
30
                                $user_id = \DB::table('team_heads')
31
                                                    ->select('user_id')
32
                                                    ->where('team_heads.team_id', '=', $teamId)
33
                                          ->where('team_heads.project_id', '=', $projectId)
34
                                          ->first();
35
                                if($user_id['user_id']==\Session::get('userId'))
36
                                        return "allowed";
37
                                else
38
                                      return "notAllowed";  
39
                        }
40
                        else
41
                                return "notAllowed";
42
                        break;
43
        }
44
}
45
46
public static function authorizeRead() {
47
        
48
}
49
50
}