@Override public boolean check(UserContext user, Session source) { return super.check(user, source) && SavedHQL.hasQueries( Flag.APPEARANCE_SECTIONING, user.getCurrentAuthority().hasRight(Right.HQLReportsAdminOnly)); }
@Override @PreAuthorize( "(#query.id != null and checkPermission(#query.id, 'SavedHQL', 'HQLReportEdit')) or (#query.id == null and checkPermission('HQLReportAdd'))") public GwtRpcResponseLong execute(HQLStoreRpcRequest query, SessionContext context) { if (SavedHQL.Flag.ADMIN_ONLY.isSet(query.getFlags())) sessionContext.checkPermission(Right.HQLReportsAdminOnly); org.hibernate.Session hibSession = SavedHQLDAO.getInstance().getSession(); SavedHQL hql = null; if (query.getId() != null) { hql = SavedHQLDAO.getInstance().get(query.getId(), hibSession); } if (hql == null) { hql = new SavedHQL(); } hql.setName(query.getName()); hql.setDescription(query.getDescription()); hql.setType(query.getFlags()); hql.setQuery(query.getQuery()); hibSession.saveOrUpdate(hql); hibSession.flush(); hibSession.refresh(hql); return new GwtRpcResponseLong(hql.getUniqueId()); }
@Override public boolean check(UserContext user, SavedHQL source) { if (source.isSet(SavedHQL.Flag.ADMIN_ONLY)) return user.getCurrentAuthority().hasRight(Right.HQLReportsAdminOnly); return true; }