Skip to content

The Unified and Autonomous Development Platform

Add necessary comment over AbstractRealm and User.

robin shine0d2307a3a8b9
diff --git a/commons.shiro/src/main/java/com/pmease/commons/shiro/AbstractRealm.java b/commons.shiro/src/main/java/com/pmease/commons/shiro/AbstractRealm.java
index 4377feb08d..5cbe17ae80 100644
--- a/commons.shiro/src/main/java/com/pmease/commons/shiro/AbstractRealm.java
+++ b/commons.shiro/src/main/java/com/pmease/commons/shiro/AbstractRealm.java
@@ -74,6 +74,15 @@ public abstract class AbstractRealm extends AuthorizingRealm {
return authenticationInfoOf((UsernamePasswordToken) token);
}
+ /**
+ * Get collection of permissions for specified user identifier.
+ *
+ * @param userId
+ * identifier of user to get permissions for. Specifically, value <tt>0</tt> stands for
+ * anonymous user
+ * @return
+ * collection of permissions associated with specified user identifier
+ */
protected abstract Collection<Permission> permissionsOf(Long userId);
/**
diff --git a/gitop.core/src/main/java/com/pmease/gitop/core/model/User.java b/gitop.core/src/main/java/com/pmease/gitop/core/model/User.java
index 0ffc6a48e3..a9806c56b5 100644
--- a/gitop.core/src/main/java/com/pmease/gitop/core/model/User.java
+++ b/gitop.core/src/main/java/com/pmease/gitop/core/model/User.java
@@ -184,6 +184,13 @@ public class User extends AbstractUser implements ProtectedObject {
return null;
}
+ /**
+ * Get current authenticated user in Shiro context, or <tt>null</tt> if not
+ * authenticated.
+ *
+ * @return
+ * current authenticated user, or <tt>null</tt> for anonymous access
+ */
public static User getCurrent() {
Long userId = getCurrentId();
if (userId != 0L) {