syncope-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Massimiliano Perrone <massimiliano.perr...@tirasa.net>
Subject ConfigurationLogic behavior
Date Tue, 13 Oct 2015 10:50:09 GMT
Hi all,
I found this "strange" behavior working with ConfigurationService class.

When I try to delete a configuration I get always a valid response also 
when the configuration key doesn't exist (while I was expecting a 
NotFound error).
Reading the code I found below difference from (1) ConfigurationLogic 
and, for instance, (2) SchemaLogic classes:

(1)
@PreAuthorize("hasRole('" + Entitlement.CONFIGURATION_DELETE + "')")
     public void delete(final String schema) {
         confDAO.delete(schema);
     }

(2)
@PreAuthorize("hasRole('" + Entitlement.SCHEMA_DELETE + "')")
     public void delete(final SchemaType schemaType, final String 
schemaName) {
         if (!doesSchemaExist(schemaType, schemaName)) {
             throw new NotFoundException(schemaType + "/" + schemaName);
         }

         switch (schemaType) {
             case VIRTUAL:
                 virSchemaDAO.delete(schemaName);
                 break;

             case DERIVED:
                 derSchemaDAO.delete(schemaName);
                 break;

             case PLAIN:
             default:
                 plainSchemaDAO.delete(schemaName);
         }
     }

As you can read the second class has a control on schema existence, the 
first one hasn't.
It is the right behavior?

Massi

-- 
Massimiliano Perrone
Tel +39 393 9121310

Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel +39 0859116307 / FAX +39 0859111173
http://www.tirasa.net

"L'apprendere molte cose non insegna l'intelligenza"
(Eraclito)


Mime
View raw message