1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements.  See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership.  The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License.  You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 package org.apache.hadoop.hbase.security.visibility;
19 
20 import org.apache.hadoop.hbase.classification.InterfaceAudience;
21 import org.apache.hadoop.hbase.NamespaceDescriptor;
22 import org.apache.hadoop.hbase.TableName;
23 import org.apache.hadoop.hbase.util.Bytes;
24 
25 @InterfaceAudience.Private
26 public final class VisibilityConstants {
27 
28   /**
29    * The string that is used as key in setting the Operation attributes for visibility labels
30    */
31   public static final String VISIBILITY_LABELS_ATTR_KEY = "VISIBILITY";
32 
33   /** Internal storage table for visibility labels */
34   public static final TableName LABELS_TABLE_NAME = TableName.valueOf(
35       NamespaceDescriptor.SYSTEM_NAMESPACE_NAME_STR, "labels");
36 
37   /** Family for the internal storage table for visibility labels */
38   public static final byte[] LABELS_TABLE_FAMILY = Bytes.toBytes("f");
39 
40   /** Qualifier for the internal storage table for visibility labels */
41   public static final byte[] LABEL_QUALIFIER = new byte[1];
42 
43   /**
44    * Visibility serialization version format. It indicates the visibility labels
45    * are sorted based on ordinal
46    **/
47   public static final byte SORTED_ORDINAL_SERIALIZATION_FORMAT = 1;
48   /** Byte representation of the visibility_serialization_version **/
49   public static final byte[] SORTED_ORDINAL_SERIALIZATION_FORMAT_TAG_VAL =
50       new byte[] { SORTED_ORDINAL_SERIALIZATION_FORMAT };
51 
52   public static final String CHECK_AUTHS_FOR_MUTATION =
53       "hbase.security.visibility.mutations.checkauths";
54 
55   public static final String NOT_OPERATOR = "!";
56   public static final String AND_OPERATOR = "&";
57   public static final String OR_OPERATOR = "|";
58   public static final String OPEN_PARAN = "(";
59   public static final String CLOSED_PARAN = ")";
60 
61   /** Label ordinal value for invalid labels */
62   public static final int NON_EXIST_LABEL_ORDINAL = 0;
63 }
64