- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xo::oauth::Package
::xo::oauth::Package create ... \
[ -folder_id (default "0") ]
Class Relations
::xo::PackageMgr create ::xo::oauth::Package \ -superclass ::xo::PackageMethods (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)
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables