BrightSide Workbench Full Report + Source Code
PermissionMap.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2022 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.security;
20 
21 import java.util.Collection;
22 import java.util.Map;
23 import java.util.Set;
24 
29 public class PermissionMap implements Map<String, Boolean> {
30 
31  private final FlatPermissions flatPermissions;
32 
33  public PermissionMap(FlatPermissions contactPermissions) {
34  this.flatPermissions = contactPermissions;
35  }
36 
37  @Override
38  public int size() {
39  return flatPermissions.size();
40  }
41 
42  @Override
43  public boolean isEmpty() {
44  return flatPermissions.isEmpty();
45  }
46 
47  @Override
48  public boolean containsKey(Object key) {
49  return flatPermissions.containsKey(key);
50  }
51 
52  @Override
53  public boolean containsValue(Object value) {
54  throw new UnsupportedOperationException("Not supported yet.");
55  }
56 
57  @Override
58  public Boolean get(Object key) {
59  return flatPermissions.isInRole((String) key);
60  }
61 
62  @Override
63  public Boolean put(String key, Boolean value) {
64  throw new UnsupportedOperationException("Not supported yet.");
65  }
66 
67  @Override
68  public Boolean remove(Object key) {
69  throw new UnsupportedOperationException("Not supported yet.");
70  }
71 
72  @Override
73  public void putAll(Map<? extends String, ? extends Boolean> m) {
74  throw new UnsupportedOperationException("Not supported yet.");
75  }
76 
77  @Override
78  public void clear() {
79  throw new UnsupportedOperationException("Not supported yet.");
80  }
81 
82  @Override
83  public Set<String> keySet() {
84  return flatPermissions.keySet();
85  }
86 
87  @Override
88  public Collection<Boolean> values() {
89  throw new UnsupportedOperationException("Not supported yet.");
90  }
91 
92  @Override
93  public Set<Map.Entry<String, Boolean>> entrySet() {
94  throw new UnsupportedOperationException("Not supported yet.");
95  }
96 
97 }
Set< Map.Entry< String, Boolean > > entrySet()
boolean containsValue(Object value)
PermissionMap(FlatPermissions contactPermissions)
Collection< Boolean > values()
void putAll(Map<? extends String, ? extends Boolean > m)
Boolean put(String key, Boolean value)