Skip to content

Commit

Permalink
Merge pull request opencadc#230 from pdowler/master
Browse files Browse the repository at this point in the history
add option to carry extra posix info to PosixPrincipal
  • Loading branch information
pdowler authored Sep 20, 2023
2 parents eba67f1 + 94722f7 commit 68568d9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cadc-util/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sourceCompatibility = 1.8

group = 'org.opencadc'

version = '1.9.10'
version = '1.9.11'

description = 'OpenCADC core utility library'
def git_url = 'https://github.com/opencadc/core'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,9 @@ public static String getPrincipalType(Principal userID) {
if (userID instanceof NumericPrincipal) {
return IdentityType.CADC.getValue().toLowerCase();
}
if (userID instanceof PosixPrincipal) {
return IdentityType.POSIX.getValue().toLowerCase();
}
return null;
}
}
10 changes: 9 additions & 1 deletion cadc-util/src/main/java/ca/nrc/cadc/auth/PosixPrincipal.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@
* Class that represents a Posix Principal. This is useful for representing a
* user with a PosixAccount key reference.
*/
public class PosixPrincipal implements Principal, Serializable {
public class PosixPrincipal implements Comparable<PosixPrincipal>, Principal, Serializable {
private static final long serialVersionUID = 5423257890488724644L;
private int uidNumber;

public Integer defaultGroup;
public String username;

/**
* Ctor
Expand Down Expand Up @@ -102,6 +105,11 @@ public boolean equals(Object obj) {
return true;
}

@Override
public int compareTo(PosixPrincipal t) {
return Integer.compare(uidNumber, t.uidNumber);
}

@Override
public String toString() {
return "PosixPrincipal [uidNumber=" + uidNumber + "]";
Expand Down

0 comments on commit 68568d9

Please sign in to comment.