예제 #1
0
 @Override
 public void deleteGroup(Group group) {
   User user = getCurrentUser();
   if (user.getId().equals(group.getOwnerUserId())) {
     if (logger.isInfoEnabled()) logger.info("deleting group " + group);
     groupService.deleteGroup(group);
   } else {
     logger.warn("Security violation. " + user + " attempted to delete " + group);
   }
 }
예제 #2
0
 @Override
 public Group saveGroup(Group group) {
   User user = getCurrentUser();
   if (user.getId().equals(group.getOwnerUserId())) {
     if (logger.isInfoEnabled()) logger.info("saving group " + group);
     return groupService.saveGroup(group);
   }
   logger.warn("Security violation. " + user + " attempted to save " + group);
   return group;
 }
예제 #3
0
 @Override
 public void addUserToGroup(Group group, User user) {
   User sessionUser = getCurrentUser();
   if (group.getOwnerUserId().equals(sessionUser.getId())) {
     if (logger.isInfoEnabled())
       logger.info(sessionUser + " is adding " + user + "  to  " + group);
     groupService.addUserToGroup(user, group, Group.Role.READONLY);
   } else {
     logger.warn(
         "Security violation. " + sessionUser + " attempted to add " + user + "  to  " + group);
   }
 }
예제 #4
0
 @Override
 public List<User> getGroupMembers(Group group) {
   User sessionUser = getCurrentUser();
   if (group.getOwnerUserId().equals(sessionUser.getId())) {
     if (logger.isInfoEnabled())
       logger.info(sessionUser + " is retrieving a list of users for group " + group);
     return userService.findUsers(group);
   } else {
     logger.warn(
         "Security violation. "
             + sessionUser
             + " attempted to retrieve a list of users for group "
             + group);
     return null;
   }
 }
예제 #5
0
 @Override
 public void removeUserFromGroup(Group group, User user) {
   User sessionUser = getCurrentUser();
   if (group.getOwnerUserId().equals(sessionUser.getId())) {
     if (logger.isInfoEnabled())
       logger.info(sessionUser + " is removing " + user + "  from  " + group);
     groupService.removeUserFromGroup(user, group);
   } else {
     logger.warn(
         "Security violation. "
             + sessionUser
             + " attempted to remove "
             + user
             + "  from  "
             + group);
   }
 }