1 25 package org.ofbiz.service; 26 27 import org.ofbiz.entity.GenericValue; 28 import org.ofbiz.security.Security; 29 30 import java.util.List ; 31 import java.util.Iterator ; 32 import java.util.LinkedList ; 33 import java.io.Serializable ; 34 35 42 public class ModelPermGroup implements Serializable { 43 44 public static final String module = ModelPermGroup.class.getName(); 45 46 public static final String PERM_JOIN_AND = "AND"; 47 public static final String PERM_JOIN_OR = "OR"; 48 49 public List permissions = new LinkedList (); 50 public String joinType; 51 52 public boolean evalPermissions(Security security, GenericValue userLogin) { 53 if (permissions != null && permissions.size() > 0) { 54 boolean foundOne = false; 55 Iterator i = permissions.iterator(); 56 while (i.hasNext()) { 57 ModelPermission perm = (ModelPermission) i.next(); 58 if (perm.evalPermission(security, userLogin)) { 59 foundOne = true; 60 } else { 61 if (joinType.equals(PERM_JOIN_AND)) { 62 return false; 63 } 64 } 65 } 66 return foundOne; 67 } else { 68 return true; 69 } 70 } 71 } 72 | Popular Tags |