1 package com.edf.gde.common;
3 import java.util.HashMap;
4 import java.util.HashSet;
12 public class PermissionManager {
18 Map<String, Set<Long>> userPermissions;
20 public PermissionManager() {
21 userPermissions = new HashMap<>();
24 public synchronized void addUser(String serviceName, long userId) {
25 Set<Long> users = userPermissions.get(serviceName);
27 users = new HashSet<>();
29 userPermissions.put(serviceName, users);
35 public synchronized boolean isValid(String serviceName, long userId) {
36 Set<Long> users = userPermissions.get(serviceName);
40 return users.contains(userId);