Пример #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);
   }
 }