Examples of RoleDescriptor


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

   * @exception StandardException  Thrown on error
   */
  public RoleDescriptor getRoleDefinitionDescriptor(String roleName)
    throws StandardException
  {
    RoleDescriptor rd = locateRoleDefinitionRow(roleName);

    return rd;
  }
View Full Code Here

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

  public RoleDescriptor getRoleGrantDescriptor(String roleName,
                         String grantee,
                         String grantor)
    throws StandardException
  {
    RoleDescriptor rd = locateRoleGrantRow(roleName, grantee, grantor);

    return rd;
  }
View Full Code Here

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

   * @exception StandardException  Thrown on error
   */
  public RoleDescriptor getRoleDefinitionDescriptor(String roleName)
    throws StandardException
  {
    RoleDescriptor rd = locateRoleDefinitionRow(roleName);

    return rd;
  }
View Full Code Here

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

  public RoleDescriptor getRoleGrantDescriptor(String roleName,
                         String grantee,
                         String grantor)
    throws StandardException
  {
    RoleDescriptor rd = locateRoleGrantRow(roleName, grantee, grantor);

    return rd;
  }
View Full Code Here

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

        boolean                 wao = false;
        boolean                 isdef = false;

        if (td != null)
        {
            RoleDescriptor roleDescriptor = (RoleDescriptor)td;

            roleid = roleDescriptor.getRoleName();
            grantee = roleDescriptor.getGrantee();
            grantor = roleDescriptor.getGrantor();
            wao = roleDescriptor.isWithAdminOption();
            isdef = roleDescriptor.isDef();
            UUID oid = roleDescriptor.getUUID();
            oid_string = oid.toString();
        }

        /* Build the row to insert */
        row = getExecutionFactory().getValueRow(SYSROLES_COLUMN_COUNT);
View Full Code Here

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

         TupleDescriptor         parentTupleDescriptor,
         DataDictionary          dd )
        throws StandardException {

        DataValueDescriptor         col;
        RoleDescriptor              descriptor;
        String                      oid_string;
        String                      roleid;
        String                      grantee;
        String                      grantor;
        String                      wao;
View Full Code Here

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

        dd.startWriting(lcc);

        //
        // Check if this role already exists. If it does, throw.
        //
        RoleDescriptor rd = dd.getRoleDefinitionDescriptor(roleName);

        if (rd != null) {
            throw StandardException.
                newException(SQLState.LANG_OBJECT_ALREADY_EXISTS,
                             "Role" , roleName);
View Full Code Here

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

        ** We tell the data dictionary we're done writing at the end of
        ** the transaction.
        */
        dd.startWriting(lcc);

        RoleDescriptor rd = dd.getRoleDefinitionDescriptor(roleName);

        if (rd == null) {
            throw StandardException.newException(
                SQLState.ROLE_INVALID_SPECIFICATION, roleName);
        }

        rd.drop(lcc);

        /*
         * We dropped a role, now drop all dependents:
         * - role grants to this role
         * - grants of this role to other roles or users
View Full Code Here

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

            for (Iterator gIter = grantees.iterator(); gIter.hasNext();) {
                String grantee = (String)gIter.next();

                // check that role exists
                RoleDescriptor rd = dd.getRoleDefinitionDescriptor(role);

                if (rd == null) {
                    throw StandardException.
                        newException(SQLState.ROLE_INVALID_SPECIFICATION, role);
                }

                // Check that role is granted to us (or PUBLIC) with
                // WITH ADMIN option so we can grant (and hence
                // revoke) it. For database owner, a role definition
                // always fulfills this requirement.  If we implement
                // granting with WITH ADMIN option later, we need to
                // look for a grant to us or to PUBLIC which has WITH
                // ADMIN. The role definition descriptor will not
                // suffice in that case, so we need something like:
                //
                // rd = dd.findRoleGrantWithAdminToRoleOrPublic(grantor)
                // if (rd != null) {
                //   :
                if (grantor.equals(rd.getGrantee())) {
                    // All ok, we are database owner
                    if (SanityManager.DEBUG) {
                        SanityManager.ASSERT(
                            lcc.getDataDictionary().
                            getAuthorizationDatabaseOwner().
                            equals(grantor),
                            "expected database owner in role descriptor");
                        SanityManager.ASSERT(
                            rd.isWithAdminOption(),
                            "expected role definition to have ADMIN OPTION");
                    }
                } else {
                    throw StandardException.newException
                        (SQLState.AUTH_ROLE_DBO_ONLY, "REVOKE role");
                }

                rd = dd.getRoleGrantDescriptor(role, grantee, grantor);

                if (rd != null && withAdminOption) {
                    // NOTE: Never called yet, withAdminOption not yet
                    // implemented.

                    // revoke only the ADMIN OPTION from grantee
                    //
                    if (rd.isWithAdminOption()) {
                        // Remove old descriptor and add a new one
                        // without admin option.
                        rd.drop(lcc);
                        rd.setWithAdminOption(false);
                        dd.addDescriptor(rd,
                                         null,  // parent
                                         DataDictionary.SYSROLES_CATALOG_NUM,
                                         false, // no duplicatesAllowed
                                         tc);
                    } else {
                        activation.addWarning
                            (StandardException.newWarning
                             (SQLState.LANG_WITH_ADMIN_OPTION_NOT_REVOKED,
                              role, grantee));
                    }
                } else if (rd != null) {
                    // normal revoke of role from grantee
                    //
                    rd.drop(lcc);
                } else {
                    activation.addWarning
                        (StandardException.newWarning
                         (SQLState.LANG_ROLE_NOT_REVOKED, role, grantee));
                }
View Full Code Here

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

            ParameterValueSet pvs = activation.getParameterValueSet();
            DataValueDescriptor dvs = pvs.getParameter(0);
            thisRoleName = dvs.getString();
        }

        RoleDescriptor rd = null;

        if (thisRoleName != null) {
            try {
                rd = dd.getRoleDefinitionDescriptor(thisRoleName);
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.