package org.wamblee.photos.security;
import java.util.List;
-
import javax.inject.Inject;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import org.wamblee.security.authorization.Operation;
import org.wamblee.security.authorization.ReadOperation;
import org.wamblee.security.authorization.UrlAuthorizationRule;
+import org.wamblee.security.authorization.UserCondition;
/**
* Authorization rule for photos. A user has access to all albums owned by his
/**
* Constructs the authorization rule.
- *
*/
public PhotoAuthorizationRule() {
// Empty.
}
+ public PhotoAuthorizationRule(UserCondition aUserCondition) {
+ super(AuthorizationResult.GRANTED, aUserCondition, null, PhotoEntry.class, null);
+ }
+
@PostLoad
public void init() {
InjectorBuilder.getInjector().inject(this);
}
- /* (non-Javadoc)
- * @see org.wamblee.security.authorization.AuthorizationRule#getSupportedTypes()
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.wamblee.security.authorization.AuthorizationRule#getSupportedTypes()
*/
public Class[] getSupportedTypes() {
- return new Class[] { PhotoEntry.class };
+ return new Class[]{PhotoEntry.class};
}
- /* (non-Javadoc)
- * @see org.wamblee.security.authorization.AuthorizationRule#isAllowed(java.lang.Object, org.wamblee.security.authorization.Operation, org.wamblee.usermgt.User)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.wamblee.security.authorization.AuthorizationRule#isAllowed(java.lang
+ * .Object, org.wamblee.security.authorization.Operation,
+ * org.wamblee.usermgt.User)
*/
- public AuthorizationResult isAllowed(Object aResource,
- Operation anOperation, String aUser) {
+ public AuthorizationResult isAllowed(Object aResource, Operation anOperation, String aUser) {
if (!(aResource instanceof PhotoEntry)) {
return AuthorizationResult.UNSUPPORTED_RESOURCE;
}
return ((PhotoEntry) aResource).getPath();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Object#toString()
*/
@Override