Package org.apache.derby.iapi.sql.dictionary

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


      List requiredPermissionsList = activation.getPreparedStatement().getRequiredPermissionsList();
      if (requiredPermissionsList != null && ! requiredPermissionsList.isEmpty())
      {
        for(Iterator iter = requiredPermissionsList.iterator();iter.hasNext();)
        {
          StatementPermission statPerm = (StatementPermission) iter.next();
          //First check if we are dealing with a Table or
          //Column level privilege. All the other privileges
          //are not required for a foreign key constraint.
          if (statPerm instanceof StatementTablePermission)
          {//It is a table/column level privilege
            StatementTablePermission statementTablePermission =
              (StatementTablePermission) statPerm;
            //Check if we are dealing with REFERENCES privilege.
            //If not, move on to the next privilege in the
            //required privileges list
            if (statementTablePermission.getPrivType() != Authorizer.REFERENCES_PRIV)
              continue;
            //Next check is this REFERENCES privilege is
            //on the same table as referenced by the foreign
            //key constraint? If not, move on to the next
            //privilege in the required privileges list
            if (!statementTablePermission.getTableUUID().equals(refTableUUID))
              continue;
          } else if (statPerm instanceof StatementSchemaPermission
              || statPerm instanceof StatementRoutinePermission)
            continue;

          //We know that we are working with a REFERENCES
          //privilege. Find all the PermissionDescriptors for
          //this privilege and make constraint depend on it
          //through dependency manager.
          //The REFERENCES privilege could be defined at the
          //table level or it could be defined at individual
          //column levels. In addition, individual column
          //REFERENCES privilege could be available at the
          //user level or PUBLIC level.
          permDesc = statPerm.getPermissionDescriptor(lcc.getAuthorizationId(), dd);       
          if (permDesc == null)
          {
            //No REFERENCES privilege exists for given
            //authorizer at table or column level.
            //REFERENCES privilege has to exist at at PUBLIC level
            permDesc = statPerm.getPermissionDescriptor(Authorizer.PUBLIC_AUTHORIZATION_ID, dd);
            if (!(permDesc.checkOwner(lcc.getAuthorizationId())))
              dm.addDependency(dependent, permDesc, lcc.getContextManager());
          } else
            //if the object on which permission is required is owned by the
            //same user as the current user, then no need to keep that
View Full Code Here


      List requiredPermissionsList = activation.getPreparedStatement().getRequiredPermissionsList();
      if (requiredPermissionsList != null && ! requiredPermissionsList.isEmpty())
      {
        for(Iterator iter = requiredPermissionsList.iterator();iter.hasNext();)
        {
          StatementPermission statPerm = (StatementPermission) iter.next();
          //The schema ownership permission just needs to be checked
          //at object creation time, to see if the object creator has
          //permissions to create the object in the specified schema.
          //But we don't need to add schema permission to list of
          //permissions that the object is dependent on once it is
          //created.
          if (statPerm instanceof StatementSchemaPermission)
            continue;
          //See if we can find the required privilege for given authorizer?
          permDesc = statPerm.getPermissionDescriptor(lcc.getAuthorizationId(), dd);       
          if (permDesc == null)//privilege not found for given authorizer
          {
            //The if condition above means that required privilege does
            //not exist at the user level. The privilege has to exist at
            //PUBLIC level.
            permDesc = statPerm.getPermissionDescriptor(Authorizer.PUBLIC_AUTHORIZATION_ID, dd);
            //If the user accessing the object is the owner of that
            //object, then no privilege tracking is needed for the
            //owner.
            if (!(permDesc.checkOwner(lcc.getAuthorizationId())))
              dm.addDependency(dependent, permDesc, lcc.getContextManager());
View Full Code Here

      List requiredPermissionsList = activation.getPreparedStatement().getRequiredPermissionsList();
      if (requiredPermissionsList != null && ! requiredPermissionsList.isEmpty())
      {
        for(Iterator iter = requiredPermissionsList.iterator();iter.hasNext();)
        {
          StatementPermission statPerm = (StatementPermission) iter.next();
          //First check if we are dealing with a Table or
          //Column level privilege. All the other privileges
          //are not required for a foreign key constraint.
          if (statPerm instanceof StatementTablePermission)
          {//It is a table/column level privilege
            StatementTablePermission statementTablePermission =
              (StatementTablePermission) statPerm;
            //Check if we are dealing with REFERENCES privilege.
            //If not, move on to the next privilege in the
            //required privileges list
            if (statementTablePermission.getPrivType() != Authorizer.REFERENCES_PRIV)
              continue;
            //Next check is this REFERENCES privilege is
            //on the same table as referenced by the foreign
            //key constraint? If not, move on to the next
            //privilege in the required privileges list
            if (!statementTablePermission.getTableUUID().equals(refTableUUID))
              continue;
          } else if (statPerm instanceof StatementSchemaPermission
              || statPerm instanceof StatementRoutinePermission)
            continue;

          //We know that we are working with a REFERENCES
          //privilege. Find all the PermissionDescriptors for
          //this privilege and make constraint depend on it
          //through dependency manager.
          //The REFERENCES privilege could be defined at the
          //table level or it could be defined at individual
          //column levels. In addition, individual column
          //REFERENCES privilege could be available at the
          //user level or PUBLIC level.
          permDesc = statPerm.getPermissionDescriptor(lcc.getAuthorizationId(), dd);       
          if (permDesc == null)
          {
            //No REFERENCES privilege exists for given
            //authorizer at table or column level.
            //REFERENCES privilege has to exist at at PUBLIC level
            permDesc = statPerm.getPermissionDescriptor(Authorizer.PUBLIC_AUTHORIZATION_ID, dd);
            if (!(permDesc.checkOwner(lcc.getAuthorizationId())))
              dm.addDependency(dependent, permDesc, lcc.getContextManager());
          } else
            //if the object on which permission is required is owned by the
            //same user as the current user, then no need to keep that
View Full Code Here

      List requiredPermissionsList = activation.getPreparedStatement().getRequiredPermissionsList();
      if (requiredPermissionsList != null && ! requiredPermissionsList.isEmpty())
      {
        for(Iterator iter = requiredPermissionsList.iterator();iter.hasNext();)
        {
          StatementPermission statPerm = (StatementPermission) iter.next();
          //The schema ownership permission just needs to be checked
          //at object creation time, to see if the object creator has
          //permissions to create the object in the specified schema.
          //But we don't need to add schema permission to list of
          //permissions that the object is dependent on once it is
          //created.
          if (statPerm instanceof StatementSchemaPermission)
            continue;
          //See if we can find the required privilege for given authorizer?
          permDesc = statPerm.getPermissionDescriptor(lcc.getAuthorizationId(), dd);       
          if (permDesc == null)//privilege not found for given authorizer
          {
            //The if condition above means that required privilege does
            //not exist at the user level. The privilege has to exist at
            //PUBLIC level.
            permDesc = statPerm.getPermissionDescriptor(Authorizer.PUBLIC_AUTHORIZATION_ID, dd);
            //If the user accessing the object is the owner of that
            //object, then no privilege tracking is needed for the
            //owner.
            if (!(permDesc.checkOwner(lcc.getAuthorizationId())))
              dm.addDependency(dependent, permDesc, lcc.getContextManager());
View Full Code Here

      if (requiredPermissionsList != null && ! requiredPermissionsList.isEmpty())
      {
        for(Iterator iter = requiredPermissionsList.iterator();iter.hasNext();)
        {
          StatementPermission statPerm = (StatementPermission) iter.next();
          //First check if we are dealing with a Table or
          //Column level privilege. All the other privileges
          //are not required for a foreign key constraint.
          if (statPerm instanceof StatementTablePermission)
          {//It is a table/column level privilege
            StatementTablePermission statementTablePermission =
              (StatementTablePermission) statPerm;
            //Check if we are dealing with REFERENCES privilege.
            //If not, move on to the next privilege in the
            //required privileges list
            if (statementTablePermission.getPrivType() != Authorizer.REFERENCES_PRIV)
              continue;
            //Next check is this REFERENCES privilege is
            //on the same table as referenced by the foreign
            //key constraint? If not, move on to the next
            //privilege in the required privileges list
            if (!statementTablePermission.getTableUUID().equals(refTableUUID))
              continue;
          } else if (statPerm instanceof StatementSchemaPermission
                || statPerm instanceof StatementRolePermission
                               || statPerm instanceof StatementGenericPermission ) {
            continue;
          } else {
            if (SanityManager.DEBUG) {
              SanityManager.ASSERT(
                statPerm instanceof StatementRoutinePermission,
                "only StatementRoutinePermission expected");
            }

            // skip if this permission concerns a function not
            // referenced by this constraint
            StatementRoutinePermission rp =
              (StatementRoutinePermission)statPerm;
            if (!inProviderSet(providers, rp.getRoutineUUID())) {
              continue;
            }
          }


          // We know that we are working with a REFERENCES, EXECUTE, or USAGE
          // privilege. Find all the PermissionDescriptors for this
          // privilege and make constraint depend on it through
          // dependency manager.  The REFERENCES privilege could be
          // defined at the table level or it could be defined at
          // individual column levels. In addition, individual column
          // REFERENCES privilege could be available at the user
          // level, PUBLIC or role level.  EXECUTE and USAGE privileges could be
          // available at the user level, PUBLIC or role level.
          permDesc = statPerm.getPermissionDescriptor(lcc.getAuthorizationId(), dd);       
          if (permDesc == null)
          {
            // No privilege exists for given user. The privilege
            // has to exist at at PUBLIC level....

            permDesc = statPerm.getPermissionDescriptor(Authorizer.PUBLIC_AUTHORIZATION_ID, dd);
            // .... or at the role level. Additionally, for column
            // level privileges, even if *some* were available at
            // the PUBLIC level others may be still be missing,
            // hence the call in the test below to
            // allColumnsCoveredByUserOrPUBLIC.
View Full Code Here

      List requiredPermissionsList = activation.getPreparedStatement().getRequiredPermissionsList();
      if (requiredPermissionsList != null && ! requiredPermissionsList.isEmpty())
      {
        for(Iterator iter = requiredPermissionsList.iterator();iter.hasNext();)
        {
          StatementPermission statPerm = (StatementPermission) iter.next();
          //The schema ownership permission just needs to be checked
          //at object creation time, to see if the object creator has
          //permissions to create the object in the specified schema.
          //But we don't need to add schema permission to list of
          //permissions that the object is dependent on once it is
          //created.
          //Also, StatementRolePermission should not occur here.
          if (statPerm instanceof StatementSchemaPermission ||
            statPerm instanceof StatementRolePermission) {

            if (SanityManager.DEBUG) {
              if (statPerm instanceof StatementRolePermission) {
                SanityManager.THROWASSERT(
                  "Unexpected StatementRolePermission");
              }
            }

            continue;
          }

          //See if we can find the required privilege for given authorizer?
          permDesc = statPerm.getPermissionDescriptor(lcc.getAuthorizationId(), dd);       
          if (permDesc == null)//privilege not found for given authorizer
          {
            //The if condition above means that required privilege does
            //not exist at the user level. The privilege has to exist at
            //PUBLIC level... ,
            permDesc = statPerm.getPermissionDescriptor(
              Authorizer.PUBLIC_AUTHORIZATION_ID, dd);

            boolean roleUsed = false;

            // .. or at role level
View Full Code Here

      if (requiredPermissionsList != null && ! requiredPermissionsList.isEmpty())
      {
        for(Iterator iter = requiredPermissionsList.iterator();iter.hasNext();)
        {
          StatementPermission statPerm = (StatementPermission) iter.next();
          //First check if we are dealing with a Table or
          //Column level privilege. All the other privileges
          //are not required for a foreign key constraint.
          if (statPerm instanceof StatementTablePermission)
          {//It is a table/column level privilege
            StatementTablePermission statementTablePermission =
              (StatementTablePermission) statPerm;
            //Check if we are dealing with REFERENCES privilege.
            //If not, move on to the next privilege in the
            //required privileges list
            if (statementTablePermission.getPrivType() != Authorizer.REFERENCES_PRIV)
              continue;
            //Next check is this REFERENCES privilege is
            //on the same table as referenced by the foreign
            //key constraint? If not, move on to the next
            //privilege in the required privileges list
            if (!statementTablePermission.getTableUUID().equals(refTableUUID))
              continue;
          } else if (statPerm instanceof StatementSchemaPermission
                || statPerm instanceof StatementRolePermission) {
            continue;
          } else {
            if (SanityManager.DEBUG) {
              SanityManager.ASSERT(
                statPerm instanceof StatementRoutinePermission,
                "only StatementRoutinePermission expected");
            }

            // skip if this permission concerns a function not
            // referenced by this constraint
            StatementRoutinePermission rp =
              (StatementRoutinePermission)statPerm;
            if (!inProviderSet(providers, rp.getRoutineUUID())) {
              continue;
            }
          }


          // We know that we are working with a REFERENCES or EXECUTE
          // privilege. Find all the PermissionDescriptors for this
          // privilege and make constraint depend on it through
          // dependency manager.  The REFERENCES privilege could be
          // defined at the table level or it could be defined at
          // individual column levels. In addition, individual column
          // REFERENCES privilege could be available at the user
          // level, PUBLIC or role level.  EXECUTE privilege could be
          // available at the user level, PUBLIC or role level.
          permDesc = statPerm.getPermissionDescriptor(lcc.getAuthorizationId(), dd);       
          if (permDesc == null)
          {
            // No privilege exists for given user. The privilege
            // has to exist at at PUBLIC level....

            permDesc = statPerm.getPermissionDescriptor(Authorizer.PUBLIC_AUTHORIZATION_ID, dd);
            // .... or at the role level. Additionally, for column
            // level privileges, even if *some* were available at
            // the PUBLIC level others may be still be missing,
            // hence the call in the test below to
            // allColumnsCoveredByUserOrPUBLIC.
View Full Code Here

      List requiredPermissionsList = activation.getPreparedStatement().getRequiredPermissionsList();
      if (requiredPermissionsList != null && ! requiredPermissionsList.isEmpty())
      {
        for(Iterator iter = requiredPermissionsList.iterator();iter.hasNext();)
        {
          StatementPermission statPerm = (StatementPermission) iter.next();
          //The schema ownership permission just needs to be checked
          //at object creation time, to see if the object creator has
          //permissions to create the object in the specified schema.
          //But we don't need to add schema permission to list of
          //permissions that the object is dependent on once it is
          //created.
          //Also, StatementRolePermission should not occur here.
          if (statPerm instanceof StatementSchemaPermission ||
            statPerm instanceof StatementRolePermission) {

            if (SanityManager.DEBUG) {
              if (statPerm instanceof StatementRolePermission) {
                SanityManager.THROWASSERT(
                  "Unexpected StatementRolePermission");
              }
            }

            continue;
          }

          //See if we can find the required privilege for given authorizer?
          permDesc = statPerm.getPermissionDescriptor(lcc.getAuthorizationId(), dd);       
          if (permDesc == null)//privilege not found for given authorizer
          {
            //The if condition above means that required privilege does
            //not exist at the user level. The privilege has to exist at
            //PUBLIC level... ,
            permDesc = statPerm.getPermissionDescriptor(
              Authorizer.PUBLIC_AUTHORIZATION_ID, dd);

            boolean roleUsed = false;

            // .. or at role level
View Full Code Here

      if (requiredPermissionsList != null && ! requiredPermissionsList.isEmpty())
      {
        for(Iterator iter = requiredPermissionsList.iterator();iter.hasNext();)
        {
          StatementPermission statPerm = (StatementPermission) iter.next();
          //First check if we are dealing with a Table or
          //Column level privilege. All the other privileges
          //are not required for a foreign key constraint.
          if (statPerm instanceof StatementTablePermission)
          {//It is a table/column level privilege
            StatementTablePermission statementTablePermission =
              (StatementTablePermission) statPerm;
            //Check if we are dealing with REFERENCES privilege.
            //If not, move on to the next privilege in the
            //required privileges list
            if (statementTablePermission.getPrivType() != Authorizer.REFERENCES_PRIV)
              continue;
            //Next check is this REFERENCES privilege is
            //on the same table as referenced by the foreign
            //key constraint? If not, move on to the next
            //privilege in the required privileges list
            if (!statementTablePermission.getTableUUID().equals(refTableUUID))
              continue;
          } else if (statPerm instanceof StatementSchemaPermission
                || statPerm instanceof StatementRolePermission
                               || statPerm instanceof StatementGenericPermission ) {
            continue;
          } else {
            if (SanityManager.DEBUG) {
              SanityManager.ASSERT(
                statPerm instanceof StatementRoutinePermission,
                "only StatementRoutinePermission expected");
            }

            // skip if this permission concerns a function not
            // referenced by this constraint
            StatementRoutinePermission rp =
              (StatementRoutinePermission)statPerm;
            if (!inProviderSet(providers, rp.getRoutineUUID())) {
              continue;
            }
          }


          // We know that we are working with a REFERENCES, EXECUTE, or USAGE
          // privilege. Find all the PermissionDescriptors for this
          // privilege and make constraint depend on it through
          // dependency manager.  The REFERENCES privilege could be
          // defined at the table level or it could be defined at
          // individual column levels. In addition, individual column
          // REFERENCES privilege could be available at the user
          // level, PUBLIC or role level.  EXECUTE and USAGE privileges could be
          // available at the user level, PUBLIC or role level.
                    permDesc = statPerm.getPermissionDescriptor(
                        currentUser, dd);

          if (permDesc == null)
          {
            // No privilege exists for given user. The privilege
            // has to exist at at PUBLIC level....

            permDesc = statPerm.getPermissionDescriptor(Authorizer.PUBLIC_AUTHORIZATION_ID, dd);
            // .... or at the role level. Additionally, for column
            // level privileges, even if *some* were available at
            // the PUBLIC level others may be still be missing,
            // hence the call in the test below to
            // allColumnsCoveredByUserOrPUBLIC.
View Full Code Here

      List requiredPermissionsList = activation.getPreparedStatement().getRequiredPermissionsList();
      if (requiredPermissionsList != null && ! requiredPermissionsList.isEmpty())
      {
        for(Iterator iter = requiredPermissionsList.iterator();iter.hasNext();)
        {
          StatementPermission statPerm = (StatementPermission) iter.next();
          //The schema ownership permission just needs to be checked
          //at object creation time, to see if the object creator has
          //permissions to create the object in the specified schema.
          //But we don't need to add schema permission to list of
          //permissions that the object is dependent on once it is
          //created.
          //Also, StatementRolePermission should not occur here.
          if (statPerm instanceof StatementSchemaPermission ||
            statPerm instanceof StatementRolePermission) {

            if (SanityManager.DEBUG) {
              if (statPerm instanceof StatementRolePermission) {
                SanityManager.THROWASSERT(
                  "Unexpected StatementRolePermission");
              }
            }

            continue;
          }

          //See if we can find the required privilege for given authorizer?
                    permDesc = statPerm.
                        getPermissionDescriptor(currentUser, dd);
          if (permDesc == null)//privilege not found for given authorizer
          {
            //The if condition above means that required privilege does
            //not exist at the user level. The privilege has to exist at
            //PUBLIC level... ,
            permDesc = statPerm.getPermissionDescriptor(
              Authorizer.PUBLIC_AUTHORIZATION_ID, dd);

            boolean roleUsed = false;

            // .. or at role level
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.sql.dictionary.StatementPermission

Copyright © 2018 www.massapicom. 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.