FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
Auth.php
Go to the documentation of this file.
1 <?php
2 /*
3 Copyright (C) 2014-2015, Siemens AG
4 
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 version 2 as published by the Free Software Foundation.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18 
23 namespace Fossology\Lib\Auth;
24 
34 class Auth
35 {
38  const USER_NAME = 'User';
41  const USER_ID = 'UserId';
44  const GROUP_ID = 'GroupId';
47  const USER_LEVEL = 'UserLevel';
48 
51  const PERM_NONE = 0;
54  const PERM_READ = 1;
57  const PERM_WRITE= 3;
60  const PERM_CADMIN=5;
63  const PERM_ADMIN=10;
64 
69  public static function getUserId()
70  {
71  return $GLOBALS['SysConf']['auth'][self::USER_ID];
72  }
73 
78  public static function getGroupId()
79  {
80  return $GLOBALS['SysConf']['auth'][self::GROUP_ID];
81  }
82 
87  public static function isAdmin()
88  {
89  return $_SESSION[self::USER_LEVEL]==self::PERM_ADMIN;
90  }
91 
96  public static function isClearingAdmin()
97  {
98  return $_SESSION[self::USER_LEVEL]>=self::PERM_CADMIN;
99  }
100 }
static getUserId()
Get the current user&#39;s id.
Definition: Auth.php:69
static isAdmin()
Check if user is admin.
Definition: Auth.php:87
static isClearingAdmin()
Check if user is clearing admin.
Definition: Auth.php:96
Contains the constants and helpers for authentication of user.
Definition: Auth.php:34
static getGroupId()
Get the current user&#39;s group id.
Definition: Auth.php:78
#define PERM_ADMIN
Administrator.
Definition: libfossology.h:46