Examples of TablePermsDescriptor


Examples of org.apache.derby.iapi.sql.dictionary.TablePermsDescriptor

     * @exception StandardException standard error policy
     */
    public int orPermissions( ExecRow row, PermissionsDescriptor perm, boolean[] colsChanged)
        throws StandardException
    {
        TablePermsDescriptor tablePerms = (TablePermsDescriptor) perm;
        int changeCount = 0;
        changeCount += orOnePermission( row, colsChanged, SELECTPRIV_COL_NUM, tablePerms.getSelectPriv());
        changeCount += orOnePermission( row, colsChanged, DELETEPRIV_COL_NUM, tablePerms.getDeletePriv());
        changeCount += orOnePermission( row, colsChanged, INSERTPRIV_COL_NUM, tablePerms.getInsertPriv());
        changeCount += orOnePermission( row, colsChanged, UPDATEPRIV_COL_NUM, tablePerms.getUpdatePriv());
        changeCount += orOnePermission( row, colsChanged, REFERENCESPRIV_COL_NUM, tablePerms.getReferencesPriv());
        changeCount += orOnePermission( row, colsChanged, TRIGGERPRIV_COL_NUM, tablePerms.getTriggerPriv());

        return changeCount;
    } // end of orPermissions
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.TablePermsDescriptor

     * @exception StandardException standard error policy
     */
    public int removePermissions( ExecRow row, PermissionsDescriptor perm, boolean[] colsChanged)
        throws StandardException
    {
        TablePermsDescriptor tablePerms = (TablePermsDescriptor) perm;
        int changeCount = 0;
        boolean permissionsLeft =
          ( removeOnePermission( row, colsChanged, SELECTPRIV_COL_NUM, tablePerms.getSelectPriv()) |
            removeOnePermission( row, colsChanged, DELETEPRIV_COL_NUM, tablePerms.getDeletePriv()) |
            removeOnePermission( row, colsChanged, INSERTPRIV_COL_NUM, tablePerms.getInsertPriv()) |
            removeOnePermission( row, colsChanged, UPDATEPRIV_COL_NUM, tablePerms.getUpdatePriv()) |
            removeOnePermission( row, colsChanged, REFERENCESPRIV_COL_NUM, tablePerms.getReferencesPriv()) |
            removeOnePermission( row, colsChanged, TRIGGERPRIV_COL_NUM, tablePerms.getTriggerPriv()));
        if( ! permissionsLeft)
            return -1;
        for( int i = 0; i < colsChanged.length; i++)
        {
            if( colsChanged[ i])
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.TablePermsDescriptor

    // we ask about table permission before column permissions. If a user has permission to use a
    // proper subset of the columns we will still ask about table permission every time he tries
    // to access that column subset.
    if( key instanceof TablePermsDescriptor)
    {
      TablePermsDescriptor tablePermsKey = (TablePermsDescriptor) key;
      permissions = dd.getUncachedTablePermsDescriptor( tablePermsKey);
      if( permissions == null)
      {
        // The owner has all privileges unless they have been revoked.
        TableDescriptor td = dd.getTableDescriptor( tablePermsKey.getTableUUID());
        SchemaDescriptor sd = td.getSchemaDescriptor();
        if( sd.isSystemSchema())
                {
          // RESOLVE The access to system tables is hard coded to SELECT only to everyone.
          // Is this the way we want Derby to work? Should we allow revocation of read access
          // to system tables? If so we must explicitly add a row to the SYS.SYSTABLEPERMISSIONS
          // table for each system table when a database is created.
          permissions = new TablePermsDescriptor( dd,
                              tablePermsKey.getGrantee(),
                              (String) null,
                              tablePermsKey.getTableUUID(),
                              "Y", "N", "N", "N", "N", "N");
                    // give the permission the same UUID as the system table
                    ((TablePermsDescriptor) permissions).setUUID( tablePermsKey.getTableUUID() );
                }
        else if( tablePermsKey.getGrantee().equals( sd.getAuthorizationId()))
                {
          permissions = new TablePermsDescriptor( dd,
                              tablePermsKey.getGrantee(),
                              Authorizer.SYSTEM_AUTHORIZATION_ID,
                              tablePermsKey.getTableUUID(),
                              "Y", "Y", "Y", "Y", "Y", "Y");
                }
        else
                {
          permissions = new TablePermsDescriptor( dd,
                              tablePermsKey.getGrantee(),
                              (String) null,
                              tablePermsKey.getTableUUID(),
                              "N", "N", "N", "N", "N", "N");
                }
      }
    }
    else if( key instanceof ColPermsDescriptor)
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.TablePermsDescriptor

     * @exception StandardException
     */
    public TablePermsDescriptor getTablePermissions( UUID tableUUID, String authorizationId)
        throws StandardException
    {
        TablePermsDescriptor key = new TablePermsDescriptor( this, authorizationId, (String) null, tableUUID);
        return (TablePermsDescriptor) getPermissions( key);
    } // end of getTablePermissions
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.TablePermsDescriptor

  /* @see org.apache.derby.iapi.sql.dictionary.DataDictionary#getTablePermissions */
    public TablePermsDescriptor getTablePermissions( UUID tablePermsUUID)
    throws StandardException
  {
        TablePermsDescriptor key = new TablePermsDescriptor( this, tablePermsUUID);
        return getUncachedTablePermsDescriptor( key );
  }
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.TablePermsDescriptor

     * @exception StandardException
     */
    public TablePermsDescriptor getTablePermissions( UUID tableUUID, String authorizationId)
        throws StandardException
    {
        TablePermsDescriptor key = new TablePermsDescriptor( this, authorizationId, (String) null, tableUUID);
        return (TablePermsDescriptor) getPermissions( key);
    } // end of getTablePermissions
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.TablePermsDescriptor

  /* @see org.apache.derby.iapi.sql.dictionary.DataDictionary#getTablePermissions */
    public TablePermsDescriptor getTablePermissions( UUID tablePermsUUID)
    throws StandardException
  {
        TablePermsDescriptor key = new TablePermsDescriptor( this, tablePermsUUID);
        return getUncachedTablePermsDescriptor( key );
  }
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.TablePermsDescriptor

    // we ask about table permission before column permissions. If a user has permission to use a
    // proper subset of the columns we will still ask about table permission every time he tries
    // to access that column subset.
    if( key instanceof TablePermsDescriptor)
    {
      TablePermsDescriptor tablePermsKey = (TablePermsDescriptor) key;
      permissions = dd.getUncachedTablePermsDescriptor( tablePermsKey);
      if( permissions == null)
      {
        // The owner has all privileges unless they have been revoked.
        TableDescriptor td = dd.getTableDescriptor( tablePermsKey.getTableUUID());
        SchemaDescriptor sd = td.getSchemaDescriptor();
        if( sd.isSystemSchema())
          // RESOLVE The access to system tables is hard coded to SELECT only to everyone.
          // Is this the way we want Derby to work? Should we allow revocation of read access
          // to system tables? If so we must explicitly add a row to the SYS.SYSTABLEPERMISSIONS
          // table for each system table when a database is created.
          permissions = new TablePermsDescriptor( dd,
                              tablePermsKey.getGrantee(),
                              (String) null,
                              tablePermsKey.getTableUUID(),
                              "Y", "N", "N", "N", "N", "N");
        else if( tablePermsKey.getGrantee().equals( sd.getAuthorizationId()))
          permissions = new TablePermsDescriptor( dd,
                              tablePermsKey.getGrantee(),
                              Authorizer.SYSTEM_AUTHORIZATION_ID,
                              tablePermsKey.getTableUUID(),
                              "Y", "Y", "Y", "Y", "Y", "Y");
        else
          permissions = new TablePermsDescriptor( dd,
                              tablePermsKey.getGrantee(),
                              (String) null,
                              tablePermsKey.getTableUUID(),
                              "N", "N", "N", "N", "N", "N");
      }
    }
    else if( key instanceof ColPermsDescriptor)
    {
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.TablePermsDescriptor

            grantee = getNullAuthorizationID();
            grantor = getNullAuthorizationID();
        }
        else
        {
            TablePermsDescriptor tpd = (TablePermsDescriptor) td;
            oid = tpd.getUUID();
            if ( oid == null )
            {
        oid = getUUIDFactory().createUUID();
        tpd.setUUID(oid);
            }
            tablePermID = oid.toString();

      grantee = getAuthorizationID( tpd.getGrantee());
            grantor = getAuthorizationID( tpd.getGrantor());
            tableID = tpd.getTableUUID().toString();
            selectPriv = tpd.getSelectPriv();
            deletePriv = tpd.getDeletePriv();
            insertPriv = tpd.getInsertPriv();
            updatePriv = tpd.getUpdatePriv();
            referencesPriv = tpd.getReferencesPriv();
            triggerPriv = tpd.getTriggerPriv();
        }
        ExecRow row = getExecutionFactory().getValueRow( COLUMN_COUNT);
        row.setColumn( TABLEPERMSID_COL_NUM, new SQLChar(tablePermID));
        row.setColumn( GRANTEE_COL_NUM, grantee);
        row.setColumn( GRANTOR_COL_NUM, grantor);
View Full Code Here

Examples of org.apache.derby.iapi.sql.dictionary.TablePermsDescriptor

                                  "Invalid SYSTABLEPERMS.referencesPriv column value: " + referencesPriv);
            SanityManager.ASSERT( "y".equals(triggerPriv) || "Y".equals(triggerPriv) || "N".equals(triggerPriv),
                                  "Invalid SYSTABLEPERMS.triggerPriv column value: " + triggerPriv);
        }

    TablePermsDescriptor tabPermsDesc =
        new TablePermsDescriptor( dataDictionary,
                                         getAuthorizationID( row, GRANTEE_COL_NUM),
                                         getAuthorizationID( row, GRANTOR_COL_NUM),
                                         tableUUID,
                                         selectPriv, deletePriv, insertPriv,
                                         updatePriv, referencesPriv, triggerPriv);
    tabPermsDesc.setUUID(tablePermsUUID);
    return tabPermsDesc;
    } // end of buildDescriptor
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.