Mercurial Hosting > luan
comparison core/src/luan/modules/IoLuan.java @ 204:cee6581b6f56
minor
git-svn-id: https://luan-java.googlecode.com/svn/trunk@205 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Sun, 06 Jul 2014 04:48:23 +0000 |
parents | 99eef1d0e706 |
children | 61afe2a1ce96 |
comparison
equal
deleted
inserted
replaced
203:99eef1d0e706 | 204:cee6581b6f56 |
---|---|
507 } | 507 } |
508 | 508 |
509 private static String SECURITY_KEY = "Io.Security"; | 509 private static String SECURITY_KEY = "Io.Security"; |
510 | 510 |
511 private static void check(LuanState luan,String name) throws LuanException { | 511 private static void check(LuanState luan,String name) throws LuanException { |
512 @SuppressWarnings("unchecked") | 512 Security s = (Security)luan.registry().get(SECURITY_KEY); |
513 List<Security> list = (List<Security>)luan.registry().get(SECURITY_KEY); | 513 if( s!=null ) |
514 if( list==null ) | |
515 return; | |
516 for( Security s : list ) { | |
517 s.check(luan,name); | 514 s.check(luan,name); |
518 } | 515 } |
519 } | 516 |
520 | 517 public static void setSecurity(LuanState luan,Security s) { |
521 public static void addSecurity(LuanState luan,Security s) { | 518 luan.registry().put(SECURITY_KEY,s); |
522 @SuppressWarnings("unchecked") | |
523 List<Security> list = (List<Security>)luan.registry().get(SECURITY_KEY); | |
524 if( list==null ) { | |
525 list = new ArrayList<Security>(); | |
526 luan.registry().put(SECURITY_KEY,list); | |
527 } | |
528 list.add(s); | |
529 } | 519 } |
530 | 520 |
531 public static class DirSecurity implements Security { | 521 public static class DirSecurity implements Security { |
532 private final String[] dirs; | 522 private final String[] dirs; |
533 | 523 |