-
Notifications
You must be signed in to change notification settings - Fork 987
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RANGER-4398: security-zone API enhancements to support incremental up…
…dates and resource pagination
- Loading branch information
1 parent
4d9648b
commit f3e8e0a
Showing
12 changed files
with
1,640 additions
and
21 deletions.
There are no files selected for viewing
97 changes: 97 additions & 0 deletions
97
agents-common/src/main/java/org/apache/ranger/plugin/model/RangerPrincipal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you 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. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.apache.ranger.plugin.model; | ||
|
||
import org.codehaus.jackson.annotate.JsonAutoDetect; | ||
import org.codehaus.jackson.annotate.JsonIgnoreProperties; | ||
import org.codehaus.jackson.map.annotate.JsonSerialize; | ||
|
||
import javax.xml.bind.annotation.XmlAccessType; | ||
import javax.xml.bind.annotation.XmlAccessorType; | ||
import javax.xml.bind.annotation.XmlRootElement; | ||
import java.util.Objects; | ||
|
||
@JsonAutoDetect(fieldVisibility=JsonAutoDetect.Visibility.ANY) | ||
@JsonSerialize(include=JsonSerialize.Inclusion.NON_EMPTY) | ||
@JsonIgnoreProperties(ignoreUnknown=true) | ||
@XmlRootElement | ||
@XmlAccessorType(XmlAccessType.FIELD) | ||
public class RangerPrincipal implements java.io.Serializable { | ||
private static final long serialVersionUID = 1L; | ||
|
||
public enum PrincipalType { USER, GROUP, ROLE } | ||
|
||
private PrincipalType type; | ||
private String name; | ||
|
||
public RangerPrincipal() { | ||
this(null, null); | ||
} | ||
|
||
public RangerPrincipal(PrincipalType type, String name) { | ||
setType(type); | ||
setName(name); | ||
} | ||
|
||
public PrincipalType getType() { | ||
return type; | ||
} | ||
|
||
public void setType(PrincipalType type) { | ||
this.type = type; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(type, name); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
final boolean ret; | ||
|
||
if (this == obj) { | ||
ret = true; | ||
} else if (obj == null) { | ||
ret = false; | ||
} else if (getClass() != obj.getClass()) { | ||
ret = false; | ||
} else { | ||
RangerPrincipal other = (RangerPrincipal) obj; | ||
|
||
ret = Objects.equals(type, other.type) && Objects.equals(name, other.name); | ||
} | ||
|
||
return ret; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "{type=" + type + ", name=" + name + "}"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.