X-Git-Url: https://gerrit.onap.org/r/gitweb?p=aaf%2Fauthz.git;a=blobdiff_plain;f=cadi%2Fcore%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fcadi%2FUser.java;h=978375551412377524c7ee4609e42b34053f0752;hp=cb3b4e8fdf07dd6359fc1cc0b182bbf4c87d88aa;hb=1296352d8eafee57f982a4342ad79ada4aa56d28;hpb=bdce7667a6e272e2fa32e298d957a0d9090c5bc9 diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/User.java b/cadi/core/src/main/java/org/onap/aaf/cadi/User.java index cb3b4e8f..97837555 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/User.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/User.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,7 +31,7 @@ import org.onap.aaf.cadi.lur.LocalPermission; /** * Class to hold info from the User Perspective. - * + * * @author Jonathan * */ @@ -44,7 +44,7 @@ public final class User { long permExpires; private final long interval; int count; - + // Note: This should only be used for Local RBAC (in memory) public User(Principal principal) { this.principal = principal; @@ -86,23 +86,23 @@ public final class User { count = 0; renewPerm(); } - + public void renewPerm() { permExpires = System.currentTimeMillis()+interval; } - + public long permExpires() { return permExpires; } - + public boolean permExpired() { return System.currentTimeMillis() > permExpires; } public boolean noPerms() { - return perms==null || perms==NULL_MAP || perms.values().size()==0; + return perms==null || perms==NULL_MAP || perms.values().size()==0; } - + public synchronized void setNoPerms() { perms=NULL_MAP; renewPerm(); @@ -115,11 +115,11 @@ public final class User { public synchronized void incCount() { ++count; } - + public synchronized void resetCount() { count=0; } - + public Map newMap() { return new ConcurrentHashMap<>(); } @@ -146,11 +146,11 @@ public final class User { } return false; } - + public void copyPermsTo(List sink) { sink.addAll(perms.values()); } - + public String toString() { StringBuilder sb = new StringBuilder(); sb.append(principal.getName());