1
0
mirror of https://github.com/sismics/docs.git synced 2025-12-13 01:36:18 +00:00

#18: ACL check for groups

This commit is contained in:
jendib
2016-03-15 22:44:50 +01:00
parent 6012cdd9a5
commit de3f055323
13 changed files with 87 additions and 72 deletions

View File

@@ -1,7 +1,11 @@
package com.sismics.security;
import java.util.List;
import org.joda.time.DateTimeZone;
import com.google.common.collect.Lists;
/**
* Anonymous principal.
*
@@ -47,12 +51,12 @@ public class AnonymousPrincipal implements IPrincipal {
return null;
}
/**
* Setter of dateTimeZone.
*
* @param dateTimeZone dateTimeZone
*/
public void setDateTimeZone(DateTimeZone dateTimeZone) {
this.dateTimeZone = dateTimeZone;
}
@Override
public List<String> getGroupIdList() {
return Lists.newArrayList();
}
}

View File

@@ -1,6 +1,7 @@
package com.sismics.security;
import java.security.Principal;
import java.util.List;
import org.joda.time.DateTimeZone;
@@ -24,6 +25,14 @@ public interface IPrincipal extends Principal {
*/
public String getId();
/**
* Returns the list of group ID of the connected user,
* or an empty list if the user is anonymous.
*
* @return List of group ID
*/
public List<String> getGroupIdList();
/**
* Returns the timezone of the principal.
*

View File

@@ -1,9 +1,12 @@
package com.sismics.security;
import java.util.List;
import java.util.Set;
import org.joda.time.DateTimeZone;
import jersey.repackaged.com.google.common.collect.Lists;
/**
* Authenticated users principal.
*
@@ -56,11 +59,6 @@ public class UserPrincipal implements IPrincipal {
return id;
}
/**
* Setter of id.
*
* @param id id
*/
public void setId(String id) {
this.id = id;
}
@@ -70,11 +68,6 @@ public class UserPrincipal implements IPrincipal {
return name;
}
/**
* Setter of name.
*
* @param name name
*/
public void setName(String name) {
this.name = name;
}
@@ -84,11 +77,6 @@ public class UserPrincipal implements IPrincipal {
return dateTimeZone;
}
/**
* Setter of dateTimeZone.
*
* @param dateTimeZone dateTimeZone
*/
public void setDateTimeZone(DateTimeZone dateTimeZone) {
this.dateTimeZone = dateTimeZone;
}
@@ -98,31 +86,21 @@ public class UserPrincipal implements IPrincipal {
return email;
}
/**
* Setter of email.
*
* @param email email
*/
public void setEmail(String email) {
this.email = email;
}
/**
* Getter of baseFunctionSet.
*
* @return baseFunctionSet
*/
public Set<String> getBaseFunctionSet() {
return baseFunctionSet;
}
/**
* Setter of baseFunctionSet.
*
* @param baseFunctionSet baseFunctionSet
*/
public void setBaseFunctionSet(Set<String> baseFunctionSet) {
this.baseFunctionSet = baseFunctionSet;
}
@Override
public List<String> getGroupIdList() {
// TODO Real groups
return Lists.newArrayList("members");
}
}