Forum OpenACS Development: Re: API Browser Support for Other Programming Languages
In essence, the information is kept in an nsv, which can be filled with data from different providers. To explore what is the content of this data structure e.g. for the function "acs_user::get_by_username", use the following from ds/shell:
nsv_dict keys api_proc_doc acs_user::get_by_username
The command "ns_dict" was introduced recently in NaviServer, for older version, one can use:
dict keys [nsv_get api_proc_doc acs_user::get_by_username]
To get a certain dict entry, use
nsv_dict get api_proc_doc acs_user::get_by_username main
So, depending on the goals, one can go different direction, it really depends, what other languages one has in mind...
Hope this helps
If I want to treat source code as content (code-content) and allow users to leverage the features of the apm and api-browser to import and explore this code-content using OpenACS, is there a way to restrict the scope of the api-browser to only certain packages? To use these tools for this purpose, it would be better if the user only had access to the imported code-content but not be exposed to the the normal code-packages that make up the OpenACS site. Is that possible within a single site?
I noticed that when setting up a sub-site, the api-browser was not an application that can be installed in a sub-site so I assume it's scope is site-wide. Is there any way to restrict that?
Thanks in advance,
If I understood correctly you need, the best way to inhibit api-browser from the user is to work properly with permission system.
Site-wide-administration, SWA, is designed to own (i.e. have access) the entire system, to access api-browser, developer support tools, and a bunch of other features. You don't want to change that. Believe me!
A Subsite administrator is the one you should be setting up to be your admin for site administration tasks.
Could you create a custom package for that?
A possibility is to make it available to site admins, then they won’t have access to the api-browser section, but they will have access to your "custom code library" package.
What I would like to do is allow the user to use the api-browser but only them to browse packages they loaded, not packages that are part of the base system.
If I understand your answer correctly, the api-browser has site-wide-administration permissions and it is bad idea to change those permissions. So, to do what I want, the best way would be to create a separate package with the same capabilities (maybe starting with the same code?) as the api-browser and set the permissions of that package as I need them. Is that correct?
The api-browser was designed and implemented as a singleton package for providing documentation for developers about the code running on this instance (there is only one code basis). If one wants multiple instances to be used for different purposes, maybe in multiple subsites, one has to
- remove the singleton-property (with all consequences),
- make the package subsite-aware (maybe not much),
- provide configuration options per instance (what kind of code you want to see),
- extend the API in what instance the data should be seen (and maybe provide as well source-code language information)
- extend the data-model (i.e. the nsvs, naming etc.)
This is some effort, but it it look in general doable to me, since the existing API and datastructures are rather simple. One should be able to provide default settings, such that existing usages can continue to work unmodified.