Proyecto

General

Perfil

Descargar (1,5 KB) Estadísticas
| Rama: | Revisión:
program serveradtospro;

{$mode objfpc}{$H+}

uses
cthreads,
Classes, SysUtils, CustApp
{ you can add units after this }, globales, demonio, clservidor, clcomandosroot;

type

{ TMyApplication }

TMyApplication = class(TCustomApplication)
private
f_usuario:String;
f_contador:integer;
protected
procedure DoRun; override;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
end;

{ TMyApplication }

procedure TMyApplication.DoRun;
begin
IF g_finalizar then terminate;
sleep(50);
end;

constructor TMyApplication.Create(TheOwner: TComponent);
const
GRUPO_PROFESORES:string='groups|grep profesor';
GRUPO_TEACHER:string='groups|grep teacher';
var
soyunprofesor:Boolean;
begin
inherited Create(TheOwner);
StopOnException:=True;
soyunprofesor:=false;
f_usuario:=GetEnvironmentVariable('USER');
if (length(Trim(HallarDatos(GRUPO_PROFESORES)))<>0) or (length(Trim(HallarDatos(GRUPO_TEACHER)))<>0) or (fusuario='root') then soyunprofesor:=true;
if soyunprofesor = false then
begin
halt;
exit;
end;
f_contador:=0;
end;

destructor TMyApplication.Destroy;
begin
inherited Destroy;
end;

var
Application: TMyApplication;

{$IFDEF WINDOWS}{$R serveralumnolinex.rc}{$ENDIF}

begin
Application:=TMyApplication.Create(nil);
Application.Run;
Application.Free;
end.

(11-11/11)