コード例 #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);
   }
 }