Initial impl of Authenticator and jsp files
This commit is contained in:
parent
41b7baa382
commit
58d4ab2f75
153 changed files with 7557 additions and 11415 deletions
30
src/zall/manager/AuthenticationManager.java
Executable file
30
src/zall/manager/AuthenticationManager.java
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
package zall.manager;
|
||||
|
||||
import zall.bean.Folder;
|
||||
import zall.bean.Media;
|
||||
import zall.bean.User;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class AuthenticationManager {
|
||||
|
||||
/**
|
||||
* @return true if the specified user can edit the media
|
||||
*/
|
||||
public static boolean canEdit(User user, Media target) {
|
||||
return target != null && (user.isSuperUser() || target.getUser().equals(user));
|
||||
}
|
||||
/**
|
||||
* @return true if the specified user can edit the media
|
||||
*/
|
||||
public static boolean canEdit(User user, Folder target) {
|
||||
return target != null && (user.isSuperUser() || user.equals( target.getUser() ));
|
||||
}
|
||||
/**
|
||||
* @return true if the specified user can edit the profile of the other user
|
||||
*/
|
||||
public static boolean canEdit(User user, User target){
|
||||
return user.equals( target ) || user.isSuperUser();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue