Changeset 7403


Ignore:
Timestamp:
Oct 4, 2017, 9:38:59 AM (5 years ago)
Author:
Nicklas Nordborg
Message:

References #2097: Implement support for device verification

Added a flag to the Client class to enable/disable support device verification. The update script will set it to false for all clients except the web client.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/Client.java

    r7381 r7403  
    209209  }
    210210
     211  /**
     212    This flag indicates if the registered client application supports
     213    device verification or not.
     214    @return TRUE if it is supported, FALSE if not
     215    @since 3.12
     216  */
     217  public boolean getSupportsDeviceVerification()
     218  {
     219    return getData().getSupportsDeviceVerification();
     220  }
     221  public void setSupportsDeviceVerification(boolean supportsDeviceVerification)
     222  {
     223    checkPermission(Permission.WRITE);
     224    getData().setSupportsDeviceVerification(supportsDeviceVerification);
     225  }
     226
     227 
    211228  /**
    212229    Create a new default setting for this client.
  • trunk/src/core/net/sf/basedb/core/Update.java

    r7392 r7403  
    937937      if (schemaVersion < 138)
    938938      {
    939         System.out.println("Setting news.sticky to false");
    940939        // Set sticky=false on all news
    941940        org.hibernate.query.Query<?> query = HibernateUtil.createQuery(session,
     
    946945      }
    947946
     947      if (schemaVersion < 139)
     948      {
     949        // Set supportsDeviceVerification = false on all clients (except on the web client)
     950        org.hibernate.query.Query<?> query = HibernateUtil.createQuery(session,
     951          "UPDATE ClientData c " +
     952          "SET c.supportsDeviceVerification = false " +
     953          "WHERE c.supportsDeviceVerification IS NULL");
     954        query.executeUpdate();
     955
     956        query = HibernateUtil.createQuery(session,
     957          "UPDATE ClientData c " +
     958          "SET c.supportsDeviceVerification = true " +
     959          "WHERE c.externalId = 'net.sf.basedb.clients.web'");
     960        query.executeUpdate();
     961      }
     962     
    948963      //  Commit the changes
    949964      HibernateUtil.commit(tx);
  • trunk/src/core/net/sf/basedb/core/data/ClientData.java

    r6127 r7403  
    7575  {
    7676    this.externalId = externalId;
     77  }
     78 
     79  private boolean supportsDeviceVerification;
     80  /**
     81    A flag indicating if this client application supports device verification.
     82    @since 3.12
     83    @hibernate.property column="`supports_device_verification`" type="boolean" not-null="true"
     84  */
     85  public boolean getSupportsDeviceVerification()
     86  {
     87    return supportsDeviceVerification;
     88  }
     89  public void setSupportsDeviceVerification(boolean supportsDeviceVerification)
     90  {
     91    this.supportsDeviceVerification = supportsDeviceVerification;
    7792  }
    7893 
  • trunk/src/install/net/sf/basedb/install/Webclient.java

    r7158 r7403  
    114114        client.setName("Web client");
    115115        client.setDescription("The web interface to BASE");
     116        client.setSupportsDeviceVerification(true);
    116117        client.setItemKey(shareToEveryone);
    117118        dc.saveItem(client);
  • trunk/www/admin/clients/edit_client.jsp

    r6295 r7403  
    113113        <td></td>
    114114      </tr>
     115      <tr>
     116        <th></th>
     117        <td><input type="checkbox" name="supports_device_verification" id="supports_device_verification" value="1"
     118          <%=(client != null && client.getSupportsDeviceVerification()) ||
     119            (client == null && Values.getBoolean(cc.getPropertyValue("supportsDeviceVerification"))) ? "checked" : ""%>
     120          ><label for="supports_device_verification">Supports device verfication</label>
     121        </td>
     122        <td></td>
     123      </tr>
    115124      <tr class="dynamic">
    116125        <th>Description</th>
  • trunk/www/admin/clients/index.jsp

    r6192 r7403  
    153153      client.setName(Values.getStringOrNull(request.getParameter("name")));
    154154      client.setDescription(Values.getStringOrNull(request.getParameter("description")));
     155      client.setSupportsDeviceVerification(Values.getBoolean(request.getParameter("supports_device_verification")));
    155156     
    156157      // OnSave extensions
  • trunk/www/admin/clients/list_clients.jsp

    r7269 r7403  
    164164        title="External ID"
    165165        sortable="true"
     166        filterable="true"
     167        exportable="true"
     168      />
     169      <tbl:columndef
     170        id="supportsDeviceVerification"
     171        property="supportsDeviceVerification"
     172        datatype="boolean"
     173        title="Device verification"
     174        sortable="true"
    166175        filterable="true"
    167176        exportable="true"
     
    412421                <tbl:cell column="entryDate" value="<%=item.getEntryDate()%>" />
    413422                <tbl:cell column="externalId"><%=Values.getString(item.getExternalId())%></tbl:cell>
     423                <tbl:cell column="supportsDeviceVerification"><%=item.getSupportsDeviceVerification() ? "yes" : "no"%></tbl:cell>
    414424                <tbl:cell column="owner"
    415425                  ><base:propertyvalue
  • trunk/www/admin/clients/view_client.jsp

    r6605 r7403  
    4444  import="net.sf.basedb.clients.web.PermissionUtil"
    4545  import="net.sf.basedb.clients.web.util.HTML"
     46  import="net.sf.basedb.util.EmailUtil"
    4647  import="net.sf.basedb.util.Values"
    4748  import="net.sf.basedb.util.formatter.Formatter"
     
    221222      </tr>
    222223      <tr>
     224        <th>Device verification</th>
     225        <td><%=client.getSupportsDeviceVerification() ? "Supported" : "Not supported"%>
     226        <%
     227        if (!EmailUtil.isEnabled() && client.getSupportsDeviceVerification())
     228        {
     229          %>
     230          (You need to configure an email server in <i>base.config</i> before you can use this feature.)
     231          <%
     232        }
     233        %>
     234        </td>
     235      </tr>
     236      <tr>
    223237        <th>Owner</th>
    224238        <td><base:propertyvalue item="<%=client%>" property="owner" /></td>
Note: See TracChangeset for help on using the changeset viewer.