class SoapSecurityService extends AbstractService implements SecurityService {

	@Override
	public void deleteGroup(String sid, long groupId) throws Exception {
		checkAdministrator(sid);

		if (groupId == 1)
			throw new Exception("You cannot delete the admin group");

		try {
			GroupDAO dao = (GroupDAO) Context.get().getBean(GroupDAO.class);
			Group grp = dao.findById(groupId);
			if (grp.getType() != Group.TYPE_DEFAULT) {
				throw new Exception("You cannot delete group with id " + grp.getId() + " because it is a system group");
			}
			dao.delete(groupId);
		} catch (Throwable t) {
			log.error(t.getMessage(), t);
			throw new Exception("Unable to delete the group with id " + groupId);
		}
	}

}