<?php
namespace Biz\User;
class AnonymousUser extends CurrentUser
{
public function __construct($user = [])
{
$user = array_merge([
'id' => 0,
'currentIp' => '127.0.0.1',
'nickname' => '游客',
'email' => 'test.edusoho.com',
'roles' => [],
'locked' => false,
'org' => ['id' => $this->rootOrgId, 'orgCode' => $this->rootOrgCode],
'orgId' => $this->rootOrgId,
'orgCode' => $this->rootOrgCode,
'password' => '',
], $user);
$this->data = $user;
}
public function getRoles()
{
return [];
}
public function getPassword()
{
return '';
}
public function getSalt()
{
return '';
}
public function getUsername()
{
return '游客';
}
public function getId()
{
return 0;
}
public function isAccountNonExpired()
{
return true;
}
public function isAccountNonLocked()
{
return true;
}
public function isCredentialsNonExpired()
{
return true;
}
public function isEnabled()
{
return true;
}
public function isLogin()
{
return false;
}
public function isAdmin()
{
return false;
}
public function isSuperAdmin()
{
return false;
}
public function isTeacher()
{
return false;
}
public function isCourseManager()
{
return false;
}
public function setPermissions($permissions)
{
return $this;
}
public function getPermissions()
{
return [];
}
/**
* {@inheritdoc}
*/
public function hasPermission($code)
{
return false;
}
}