Line data Source code
1 : // Copyright (C) 2012 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.server; 16 : 17 : import com.google.gerrit.server.account.GroupMembership; 18 : 19 : /** 20 : * User identity for plugin code that needs an identity. 21 : * 22 : * <p>An InternalUser has no real identity, it acts as the server and can access anything it wants, 23 : * anytime it wants, given the JVM's own direct access to data. Plugins may use this when they need 24 : * to have a CurrentUser with read permission on anything. 25 : * 26 : * @see PluginUser 27 : */ 28 151 : public class InternalUser extends CurrentUser { 29 : public interface Factory { 30 : InternalUser create(); 31 : } 32 : 33 : @Override 34 : public GroupMembership getEffectiveGroups() { 35 23 : return GroupMembership.EMPTY; 36 : } 37 : 38 : @Override 39 : public String getCacheKey() { 40 4 : return "internal"; 41 : } 42 : 43 : @Override 44 : public boolean isInternalUser() { 45 8 : return true; 46 : } 47 : 48 : @Override 49 : public String toString() { 50 4 : return "InternalUser"; 51 : } 52 : }