public function insert($id, $idEntity) { $date = Carbon::now(); $user_entity = new UserEntity(); $user_entity->user_id = $id; $user_entity->entity_id = $idEntity; $user_entity->created_at = $date; $user_entity->updated_at = $date; $user_entity->save(); }
/** * Performs an authentication. * @return Nette\Security\Identity * @throws Nette\Security\AuthenticationException */ public function authenticate(array $credentials) { list($username, $password) = $credentials; $row = $this->em->getRepository(UserEntity::getClassName())->findOneBy(array('login' => $username)); if (!$row) { throw new Nette\Security\AuthenticationException('The username is incorrect.', self::IDENTITY_NOT_FOUND); } elseif (!Passwords::verify($password, $row->password)) { throw new Nette\Security\AuthenticationException('The password is incorrect.', self::INVALID_CREDENTIAL); } $arr = array('id' => $row->id, 'role' => ''); return new Nette\Security\Identity($arr[self::COLUMN_ID], $arr['role'], $arr); }
public function existUser($id) { $exist = False; $consult = UserEntity::getExist($id); if ($consult != []) { $exist = True; } return $exist; }