Subversion Repositories wimsdev

Rev

Rev 16367 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
16143 guerimand 1
!! decide if right is open or note for the user according to the file .E$exam .S$seq or .$sheet
2
!! wims_read_parm : file name
3
!! output : output=yes output=no
17882 czzmrn 4
!!          condition= the condition string
5
!!          accessstart= starting access date, if not empty
6
!!          accessend= ending access date, if not empty
16143 guerimand 7
 
8
data_=!record 0 of wimshome/log/classes/$wims_class/.$wims_read_parm
9
cle_=!word 1 of $data_
10
!! process for technical variable definition (replace data_ by value decide by the technical variable)
11
!if \ isin $cle_
12
  idtechvar_=!line 1 of $data_
13
  idtechvar_=!char 2 to -1 of $idtechvar_
14
  !readproc adm/class/userdef ,$wims_class,$wims_user
15
  val_=!defof user_techvar_$(idtechvar_) in $userdef
16
  !default val_=EMPTY
17
  !reset data_
18
  data_=!defof techvar_$val_ in wimshome/log/classes/$wims_class/.$wims_read_parm
19
  !default data_=none
16367 guerimand 20
  sequence_withtechvar=1
16143 guerimand 21
!endif
22
!! end process technical variable
23
 
24
condition=$data_
25
!! check condition
26
output=yes
16367 guerimand 27
!! for display of sequence in case of supervisor condition without technical variable are used 
28
!! (so supervisor can see real page of user)
29
!if $wims_user=supervisor and (S notin $wims_read_parm or \ isin $cle_)
16143 guerimand 30
  !exit
31
!endif
16367 guerimand 32
 
16143 guerimand 33
!if $condition=none
34
  output=no
35
  !exit
36
!endif
37
!if $condition!=$empty
38
  data_=!words2items $condition
39
  symb_=<,>
17882 czzmrn 40
  !reset IP_,accessend,accessstart
16143 guerimand 41
  !for l_ in $data_
42
    !set c_=!char 1 of $l_
43
    !if $(symb_[1])=$c_
17882 czzmrn 44
      accessend=!char 2 to -1 of $l_
45
      accessend=!text select char 0123456789 in $accessend
16143 guerimand 46
    !else
47
      !if $(symb_[2])=$c_
17882 czzmrn 48
        accessstart=!char 2 to -1 of $l_
49
        accessstart=!text select char 0123456789 in $accessstart
16143 guerimand 50
      !else
51
        IP_=!text select 0123456789.  in $l_
52
      !endif
53
    !endif
54
  !next l_
55
!!  !! ------ test for IP
56
!!  !! TODO this test is not operationnel
17882 czzmrn 57
!!  !! need to be careful: like this, it only works for IP (not for dns names)
16143 guerimand 58
!!  !if $IP_!=$empty_
59
!!    nb_=!charcnt $IP_
60
!!    user_=!char 1 to $nb_ of http_REMOTE_ADDR
61
!!    !if $user_!=$IP_
62
!!      output=no
63
!!      !exit
64
!!    !endif
65
!!  !endif
66
  now_=!text select char 0123456789 in $wims_now
67
  now_=!char 1 to 12 of $now_
68
  !! ----- test for expiration
17882 czzmrn 69
  !if $accessend!=$empty
70
    !if $now_>$accessend
16143 guerimand 71
      output=no
72
      !exit
73
    !endif
74
  !endif
75
  !! ----- test for begin
17882 czzmrn 76
  !if $accessstart!=$empty
77
    !if $now_<$accessstart
16143 guerimand 78
      output=no
79
      !exit
80
    !endif
81
  !endif
82
!endif