%3 ::xo::oauth::Package ::xo::oauth::Package → fill → reset index init insert ::xo::Package ::xo::Package exists_form_parameter exists_query_parameter form_parameter get_parameter handle_http_caching init initialize insert instantiate_forms process_init_parameter query_parameter reply_to_user require_root_folder return_page returnredirect set_url update ::xo::oauth::Package->::xo::Package ::xowiki::Package ::xowiki::Package → get_package_id_from_page_id → get_url_from_id → google_sitemapindex → instantiate_page_from_id → is_xowiki_p → preferredCSSToolkit → reparent_site_wide_pages call check_permissions clipboard-copy condition=has_class condition=has_name create_new_snippet default_language default_locale delete_revision error_msg external_name flush_name_cache flush_page_fragment_cache flush_references folder_path get_adp_template get_ids_for_bulk_actions get_lang_and_name get_package_id_from_page_name get_page_from_item_or_revision_id get_page_from_item_ref get_page_from_name get_page_from_super get_parameter get_parameter_from_parameter_page get_parent_and_name import init insert invoke item_info_from_id item_info_from_url item_ref join_name lookup make_form_link make_link normalize_name normalize_path package_path prefixed_lookup pretty_link query_parameter_return_url reparent require_folder_object require_root_folder resolve_package_path resolve_page resolve_page_name resolve_page_name_and_init_context show_page_order simple_item_ref split_name validate_tag www-change-page-order www-delete www-edit-category-tree www-edit-new www-google-sitemap www-google-sitemapindex www-import-prototype-page www-manage-categories www-refresh-login www-reindex www-rss www-update-references ::xowiki::Package->::xo::Package ::xowiki::ParameterCache ::xowiki::ParameterCache ::xowiki::Package->::xowiki::ParameterCache ::xo::db::Object ::xo::db::Object delete initialize_loaded_object insert save save_new update ::xo::Package->::xo::db::Object ::xotcl::Object ::xotcl::Object ::xo::db::Object->::xotcl::Object

Class ::xo::oauth::Package

::xo::oauth::Package[i] create ... \
           [ -folder_id (default "0") ]

Class Relations

  • class: ::xo::PackageMgr[i]
  • superclass: ::xo::Package[i]
::xo::PackageMgr create ::xo::oauth::Package \
     -superclass ::xo::Package

Methods (to be applied on the object)

  • fill (scripted)

    set p [::xo::oauth::Package initialize -url "/oauth"]
    #$p require_server_metadata
    
    # Create Server MD for the "remote" server
    set sm [::xo::oauth::ServerMetadata new  -parent_id [$p folder_id]  -package_id [$p id]  -temp_credentials_url "http://shell.itec.km.co.at/oauth/initiate"  -token_credentials_url "http://shell.itec.km.co.at/oauth/token"  -authorization_url "http://shell.itec.km.co.at/oauth/authorize"]
    $sm save_new
    
    # Create a dummy client metadata record
    set cm [::xo::oauth::ClientMetadata new  -parent_id [$p folder_id]  -package_id [$p id]  -title "An Example OAuth Consumer Application"  -description "This is the description of the client application"]
    $cm save_new
    
    # Create a dummy client credentials record
    set ccc [::xo::oauth::ClientCredentials new  -parent_id [$p folder_id]  -package_id [$p id]  -identifier "client1"  -secret "123"  -client_metadata_id [$cm item_id]  -server_metadata_id [[$p server_metadata] item_id]]
    $ccc save_new
    
    return [$sm serialize]
  • reset (scripted)

    # Convenience proc for development - delete all
    
    # ::xo::db::Class doesn't CASCADE on drop
    foreach object_type {
      ::xo::oauth::TempCredentials
      ::xo::oauth::TokenCredentials
      ::xo::oauth::ClientCredentials
      ::xo::oauth::Credentials
      ::xo::oauth::ClientMetadata
      ::xo::oauth::ServerMetadata
    } {
      set table_name [::xo::db::Class get_table_name -object_type $object_type]
      #my msg "set table_name ::xo::db::Class get_table_name -object_type $object_type -> $table_name"
      if { [catch {
        xo::dc dml [:qn delete_instances] "delete from $table_name"
        foreach ci [xo::dc list select_xoitems {
          select item_id from cr_items where content_type = :object_type
        }] {
          content::item::delete -item_id $ci
        }
        xo::dc dml [:qn drop_table] "drop table $table_name cascade"
        ::acs::dc call acs_object_type drop_type  -object_type $object_type -cascade_p t
      } fid] } {
        :msg "Error during delete:\n$fid"
      }
    }
    set p [::xo::oauth::Package initialize -url "/oauth"]
    ::acs::clusterwide ns_cache flush xotcl_object_type_cache root_folder-[$p id]
    ::content::folder::delete -folder_id [$p folder_id]

Methods (to be applied on instances)

  • folder_id (setter)

  • index (scripted)

    set adp /packages/xooauth/lib/index
    set :mime_type text/html
    set package [self]
    :return_page -adp $adp -variables {
      package
    }
  • init (scripted)

    next
    set :folder_id [:require_root_folder  -name "xooauth"  -content_types {
                          ::xo::oauth::Credentials*
                          ::xo::oauth::ClientMetadata*
                          ::xo::oauth::ServerMetadata*
                        }]
    ::xo::db::CrClass get_instance_from_db -item_id ${:folder_id}
    set :delivery doc_return
    #my log [:serialize]
  • insert (scripted)

    set __table_name [[self class] table_name]
    set __id [[self class] id_column]
    set :$__id ${:object_id}
    :log "ID insert in $__table_name, id = $__id = [set :$__id]"
    next
    foreach {__slot_name __slot} [[self class] array get db_slot] {
      if {[info exists :$__slot_name]} {
        set $__slot_name [set :$__slot_name]
        lappend __vars $__slot_name
        lappend __atts [$__slot column_name]
      }
    }
    ::xo::dc dml insert_$__table_name "insert into $__table_name
      ([join $__atts ,]) values (:[join $__vars ,:])"
  • package_id (setter)