import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
/**
*
/**
* MAP<K,V>
* K = Service name
- * V = Set of user Id
+ * V = Set of group Id
*/
- Map<String, Set<Long>> userPermissions;
-
- public PermissionManager() {
- userPermissions = new HashMap<>();
+ private EntityManager em;
+ public PermissionManager(EntityManager em) {
+ this.em = em;
}
- public synchronized void addUser(String serviceName, long userId) {
- Set<Long> users = userPermissions.get(serviceName);
- if (users == null) {
- users = new HashSet<>();
- users.add(userId);
- userPermissions.put(serviceName, users);
- } else {
- users.add(userId);
- }
+ public synchronized void addGroup(long groupId, String serviceName, String methodName) {
}
- public synchronized boolean isValid(String serviceName, long userId) {
- Set<Long> users = userPermissions.get(serviceName);
- if (users == null) {
- return false;
- }
- return users.contains(userId);
+ public synchronized boolean checkPermission(long userId, String serviceName, String methodeName) {
+ return false;
}
}