


    mystics mpy language has a function to check if an acs string is valid,
    depending the current users level. while trying to use it, i think i 
    found an abnormal behavior... or at least, that the function is not 
    100% accurate implemented.
    
    the problem was, that when you try to use the access() function, of 
    mpy, with an acs string like "g1s20", even if the user level is 
    greater than 20, it will return a false value. the reason is that the 
    function expects only a "s20" type string, with only the security 
    level code and not other acs codes.
    
    so i wrote another function that can manipulate any type of acs 
    string. the function will only tell you about the users security level 
    and other types of acs codes, like if a user has chosen a specific 
    file/msg base etc.
    
    the syntax is simple:  isacs(useracs,otheracs)
    
    where useracs, is the acs level of the user we want to check ex.20 and 
    otheracs is any type of an acs string ex."z1g2s40" etc. for example:
    
    isacs('20','g1s40'), will return False cause 20 is less than 40.
    
    the complete function is this:   
                          

def isacs(useracs,otheracs):
  if otheracs == "":
    return True
  val = ""
  inacs = False
  s = otheracs
  i = 0
  while i <= len(s)-1:
    if inacs:
      if s[i].isdigit():
        val = val + s[i]
      else:
        break
    if s[i] == 's':
      inacs = True
    i += 1

  if useracs >= int(val):
    return True
  else:
    return False
    
    


  <<< null e-magazine x008 (text edition) >>>    
      ____  _____          _____   _____           http://github.com/xqtr/null
  ___/.   \/    /_________/.   /__/.   /__jp!_          andr01d.zapto.org:9999
 //_       \    .   /         /   \   /    _//                   agency.bbs.nz
   /____/\____/    /    /__________________\                          d1st.org
              \________/                        