Java Code Examples for com.alibaba.dubbo.registry.common.route.ParseUtils#isMatchGlobPattern()

The following examples show how to use com.alibaba.dubbo.registry.common.route.ParseUtils#isMatchGlobPattern() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: User.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public boolean hasServicePrivilege(String service) {
	if (service == null || service.length() == 0)
		return false;
	if (role == null || GUEST.equalsIgnoreCase(role)) {
		return false;
	}
	if(ROOT.equalsIgnoreCase(role)) {
	    return true;
	}
	
	if (servicePrivileges != null && servicePrivileges.size() > 0) {
   		for (String privilege : servicePrivileges) {
               boolean ok = ParseUtils.isMatchGlobPattern(privilege,service);
               if (ok) {
               	return true;
               }
   		}
	}
	return false;
}
 
Example 2
Source File: User.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
public boolean hasServicePrivilege(String service) {
	if (service == null || service.length() == 0)
		return false;
	if (role == null || GUEST.equalsIgnoreCase(role)) {
		return false;
	}
	if(ROOT.equalsIgnoreCase(role)) {
	    return true;
	}
	
	if (servicePrivileges != null && servicePrivileges.size() > 0) {
   		for (String privilege : servicePrivileges) {
               boolean ok = ParseUtils.isMatchGlobPattern(privilege,service);
               if (ok) {
               	return true;
               }
   		}
	}
	return false;
}
 
Example 3
Source File: User.java    From dubbo3 with Apache License 2.0 6 votes vote down vote up
public boolean hasServicePrivilege(String service) {
	if (service == null || service.length() == 0)
		return false;
	if (role == null || GUEST.equalsIgnoreCase(role)) {
		return false;
	}
	if(ROOT.equalsIgnoreCase(role)) {
	    return true;
	}
	
	if (servicePrivileges != null && servicePrivileges.size() > 0) {
   		for (String privilege : servicePrivileges) {
               boolean ok = ParseUtils.isMatchGlobPattern(privilege,service);
               if (ok) {
               	return true;
               }
   		}
	}
	return false;
}
 
Example 4
Source File: User.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public boolean hasServicePrivilege(String service) {
	if (service == null || service.length() == 0)
		return false;
	if (role == null || GUEST.equalsIgnoreCase(role)) {
		return false;
	}
	if(ROOT.equalsIgnoreCase(role)) {
	    return true;
	}
	
	if (servicePrivileges != null && servicePrivileges.size() > 0) {
   		for (String privilege : servicePrivileges) {
               boolean ok = ParseUtils.isMatchGlobPattern(privilege,service);
               if (ok) {
               	return true;
               }
   		}
	}
	return false;
}
 
Example 5
Source File: User.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public boolean hasServicePrivilege(String service) {
	if (service == null || service.length() == 0)
		return false;
	if (role == null || GUEST.equalsIgnoreCase(role)) {
		return false;
	}
	if(ROOT.equalsIgnoreCase(role)) {
	    return true;
	}
	
	if (servicePrivileges != null && servicePrivileges.size() > 0) {
   		for (String privilege : servicePrivileges) {
               boolean ok = ParseUtils.isMatchGlobPattern(privilege,service);
               if (ok) {
               	return true;
               }
   		}
	}
	return false;
}
 
Example 6
Source File: Routes.java    From dubbox with Apache License 2.0 5 votes vote down vote up
/**
 * 添加与服务相关的Owner
 * 
 * @param usernames 用于添加的用户名
 * @param serviceName 不含通配符
 */
public static void addOwnersOfService(Set<String> usernames, String serviceName,
                                      OwnerService ownerDAO) {
    List<String> serviceNamePatterns = ownerDAO.findAllServiceNames();
    for (String p : serviceNamePatterns) {
        if (ParseUtils.isMatchGlobPattern(p, serviceName)) {
            List<String> list = ownerDAO.findUsernamesByServiceName(p);
            usernames.addAll(list);
        }
    }
}
 
Example 7
Source File: RelateUserUtils.java    From dubbox with Apache License 2.0 5 votes vote down vote up
/**
 * 添加与服务相关的Owner
 * 
 * @param usernames 用于添加的用户名
 * @param serviceName 不含通配符
 */
public static void addOwnersOfService(Set<String> usernames, String serviceName,
                                      OwnerService ownerDAO) {
    List<String> serviceNamePatterns = ownerDAO.findAllServiceNames();
    for (String p : serviceNamePatterns) {
        if (ParseUtils.isMatchGlobPattern(p, serviceName)) {
            List<String> list = ownerDAO.findUsernamesByServiceName(p);
            usernames.addAll(list);
        }
    }
}
 
Example 8
Source File: Routes.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
/**
 * 添加与服务相关的Owner
 * 
 * @param usernames 用于添加的用户名
 * @param serviceName 不含通配符
 */
public static void addOwnersOfService(Set<String> usernames, String serviceName,
                                      OwnerService ownerDAO) {
    List<String> serviceNamePatterns = ownerDAO.findAllServiceNames();
    for (String p : serviceNamePatterns) {
        if (ParseUtils.isMatchGlobPattern(p, serviceName)) {
            List<String> list = ownerDAO.findUsernamesByServiceName(p);
            usernames.addAll(list);
        }
    }
}
 
Example 9
Source File: RelateUserUtils.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
/**
 * 添加与服务相关的Owner
 * 
 * @param usernames 用于添加的用户名
 * @param serviceName 不含通配符
 */
public static void addOwnersOfService(Set<String> usernames, String serviceName,
                                      OwnerService ownerDAO) {
    List<String> serviceNamePatterns = ownerDAO.findAllServiceNames();
    for (String p : serviceNamePatterns) {
        if (ParseUtils.isMatchGlobPattern(p, serviceName)) {
            List<String> list = ownerDAO.findUsernamesByServiceName(p);
            usernames.addAll(list);
        }
    }
}
 
Example 10
Source File: Routes.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
/**
 * 添加与服务相关的Owner
 * 
 * @param usernames 用于添加的用户名
 * @param serviceName 不含通配符
 */
public static void addOwnersOfService(Set<String> usernames, String serviceName,
                                      OwnerService ownerDAO) {
    List<String> serviceNamePatterns = ownerDAO.findAllServiceNames();
    for (String p : serviceNamePatterns) {
        if (ParseUtils.isMatchGlobPattern(p, serviceName)) {
            List<String> list = ownerDAO.findUsernamesByServiceName(p);
            usernames.addAll(list);
        }
    }
}
 
Example 11
Source File: RelateUserUtils.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
/**
 * 添加与服务相关的Owner
 * 
 * @param usernames 用于添加的用户名
 * @param serviceName 不含通配符
 */
public static void addOwnersOfService(Set<String> usernames, String serviceName,
                                      OwnerService ownerDAO) {
    List<String> serviceNamePatterns = ownerDAO.findAllServiceNames();
    for (String p : serviceNamePatterns) {
        if (ParseUtils.isMatchGlobPattern(p, serviceName)) {
            List<String> list = ownerDAO.findUsernamesByServiceName(p);
            usernames.addAll(list);
        }
    }
}
 
Example 12
Source File: Routes.java    From dubbox with Apache License 2.0 5 votes vote down vote up
/**
 * 添加与服务相关的Owner
 * 
 * @param usernames 用于添加的用户名
 * @param serviceName 不含通配符
 */
public static void addOwnersOfService(Set<String> usernames, String serviceName,
                                      OwnerService ownerDAO) {
    List<String> serviceNamePatterns = ownerDAO.findAllServiceNames();
    for (String p : serviceNamePatterns) {
        if (ParseUtils.isMatchGlobPattern(p, serviceName)) {
            List<String> list = ownerDAO.findUsernamesByServiceName(p);
            usernames.addAll(list);
        }
    }
}
 
Example 13
Source File: RelateUserUtils.java    From dubbox with Apache License 2.0 5 votes vote down vote up
/**
 * 添加与服务相关的Owner
 * 
 * @param usernames 用于添加的用户名
 * @param serviceName 不含通配符
 */
public static void addOwnersOfService(Set<String> usernames, String serviceName,
                                      OwnerService ownerDAO) {
    List<String> serviceNamePatterns = ownerDAO.findAllServiceNames();
    for (String p : serviceNamePatterns) {
        if (ParseUtils.isMatchGlobPattern(p, serviceName)) {
            List<String> list = ownerDAO.findUsernamesByServiceName(p);
            usernames.addAll(list);
        }
    }
}
 
Example 14
Source File: Routes.java    From dubbox with Apache License 2.0 5 votes vote down vote up
/**
 * 添加与服务相关的Owner
 * 
 * @param usernames 用于添加的用户名
 * @param serviceName 不含通配符
 */
public static void addOwnersOfService(Set<String> usernames, String serviceName,
                                      OwnerService ownerDAO) {
    List<String> serviceNamePatterns = ownerDAO.findAllServiceNames();
    for (String p : serviceNamePatterns) {
        if (ParseUtils.isMatchGlobPattern(p, serviceName)) {
            List<String> list = ownerDAO.findUsernamesByServiceName(p);
            usernames.addAll(list);
        }
    }
}
 
Example 15
Source File: RelateUserUtils.java    From dubbox with Apache License 2.0 5 votes vote down vote up
/**
 * 添加与服务相关的Owner
 * 
 * @param usernames 用于添加的用户名
 * @param serviceName 不含通配符
 */
public static void addOwnersOfService(Set<String> usernames, String serviceName,
                                      OwnerService ownerDAO) {
    List<String> serviceNamePatterns = ownerDAO.findAllServiceNames();
    for (String p : serviceNamePatterns) {
        if (ParseUtils.isMatchGlobPattern(p, serviceName)) {
            List<String> list = ownerDAO.findUsernamesByServiceName(p);
            usernames.addAll(list);
        }
    }
}