|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
Changing login through JavaScriptDear experts
Yes - thanks - it is possible to use Javascript flow to access URL parameters and update user roles. Question: Is it possible to use a JavaScript flow to automatically change the user login? Thank you Valerie Nyre Maas High Tech Software _______________________________________________ daisy community mailing list Professional Daisy support: http://outerthought.org/en/services/daisy/support.html mail to: daisy@... list information: http://lists.cocoondev.org/mailman/listinfo/daisy |
|
|
Re: Changing login through JavaScriptI'm not sure what you are asking. Did you try the obvious?
i.e. I am starting to feel like a helpdesk, this is not how things work here. Please show me that you did at least some research, preferably by showing what code you already have, indicating what does work, what does not work, why you think it does not work, what do you expect your code to do, what it actually does etc etc. Here is something that may you get started with scripting the repository: http://cocoondev.org/daisydocs-1_3/repository/interfaces/153-cd.html Karel On Thu, 2008-06-26 at 17:48 +0200, Valerie Nyre wrote: > Dear experts > > Yes - thanks - it is possible to use Javascript flow to access URL > parameters and update user roles. > > Question: > Is it possible to use a JavaScript flow to automatically change the user > login? > > > > Thank you > > Valerie Nyre > Maas High Tech Software > > > > > > > > _______________________________________________ > daisy community mailing list > Professional Daisy support: http://outerthought.org/en/services/daisy/support.html > mail to: daisy@... > list information: http://lists.cocoondev.org/mailman/listinfo/daisy daisy community mailing list Professional Daisy support: http://outerthought.org/en/services/daisy/support.html mail to: daisy@... list information: http://lists.cocoondev.org/mailman/listinfo/daisy |
|
|
|
|
|
Re: Re: Changing login through JavaScriptMuch better ;-)
Note that I have never written an extension that logs in people programmatically, and I have only seen frontEndContext.login being used in the context of the LoginApple. Other than that, it seems your are doing well - I don't see why frontEndContext.login should not be used. That being said, I assume that you are having problems with these lines: > frontEndContext.login(helpUserLogin,helpUserPassword); > > showPage(helpUserLogin,helpUserPassword); Can you tell us what the result is of these lines? Is there any logging output? Karel On Fri, 2008-06-27 at 13:05 +0200, Valerie Nyre wrote: > Hello > > > Yes I understand. In fact I am slowly learning Daisy for about 2 months > or so. > > To explain: I am the typical lonely technical writer with very limited > capabilities (editing tools, basic CSS, XML, XSLT, a little JavaScript) > and very enthusiastic about finding Daisy. > > Last week, I could recommend using Daisy and we actually accomplished a > documentation task in about 1 week. We produced our first PDF book in a > collaborative fashion without disturbing each other. It took only a week > to gather the information, tweak the PDF layout and then print the book. > Even my chef had to admit that we succeeded. More important, I want to > convince the developers that we make our lives more easier. I hope that > we can migrate to Daisy one day. > > Now I want people to "jump" into "their" sites, without the need to > login first. But after attempting I assume that I need to know more > about cocoon pipelining. There is a user cache that needs to be > contextualized some how.. . So at the moment I fear that I am not > capable of doing this. > > > I think I will have to do more and the first inspiration might be: > daisy_mailinglist_programmatically_logging in users_008841.html > [daisy] Integration with Tomcat User Authentication_000469.html > > > > My level of programming sophistication is very low and I assume short > questions would not waste your time , but if you think it worth while I > glady show what I am trying out today. > > > Taking the guestbook example, i start with replacing the first function > call .... > Now after successfully updating the user ... I want to enter the Daisy > WIKI site again under this user's identity - if possible. > > The l > What works today (only the possibility to change the user roles / define > a user): > > > // get the parameters from the request > var helpUserLogin = cocoon.request.getParameter("user"); > var helpUserPassword = cocoon.request.getParameter("pass"); > var helpUserEmail = cocoon.request.getParameter("mail"); > var defaultRoleToSet = "OHELP"; > > var rolesRequested = ""; > var collections = ""; > collections = cocoon.request.getParameter("collections"); > outputString = "collections = " + collections; > if (collections) { > var collpattern = ","; > rolesRequested = collections.split(collpattern); > } > > > // access Daisy and use the predefined administrator to get > available roles and to maintain the user > var daisy = getDaisy(); > var admin = "OADMIN"; > var adminPassword = "mhtmht"; > > var repository = daisy.getRepository(admin,adminPassword); > var userManager = repository.getUserManager(); > var adminUser = userManager.getUser(admin, true) > var adminInfos = repository.getUserInfoAsXml(); > > // prepare roles to add > var userDefaultRole = userManager.getRole(defaultRoleToSet,true); > var rolesToAdd = new Array; > var k = 0; > > > // this query returns roles of the admin user - which makes it > possible to limit possible roles > var rolesPossible = adminUser.allRoles.array; > var regExpr = /\w+/; > if ((collections != "") && (rolesPossible != "" )) { > for (var i=0; i<rolesRequested.length; i++) { > for (var j=0; j<rolesPossible.length; j++) { > var test1 = rolesPossible[j].name.toString() ; > var test2 = rolesRequested[i].match(regExpr); > if (test1 == test2[0] ) { > rolesToAdd[k] = rolesPossible[j]; > k=k+1; > // break; > } > } > }; > } > > > // possible exceptions to catch > var UserNotFoundException = /UserNotFoundException/; > > try { > var helpUser = userManager.getUser(helpUserLogin, true); > helpUser.clearRoles(); > helpUser.addToRole(userDefaultRole); > if(rolesToAdd != "") { > for (var i=0; i< rolesToAdd.length;i++) { > helpUser.addToRole(rolesToAdd[i]); > } > } > helpUser.save(); > > // > } > catch (UserNotFoundException) { > > var helpUser = userManager.createUser(helpUserLogin); > helpUser.setFirstName("Pia"); > helpUser.setLastName("Studinger"); > helpUser.setEmail("valerie at maas.de"); > helpUser.setPassword(helpUserPassword); > helpUser.setUpdateableByUser(false); > helpUser.setConfirmed(true); > helpUser.addToRole(userDefaultRole); > for (var i=0; i< rolesToAdd.length;i++) { > helpUser.addToRole(rolesToAdd[i]); > } > helpUser.save(); > > } > > ????????????????????????????????????????? > this is where I am "tinkering" at the moment: > ????????????????????????????????????????? > frontEndContext.login(helpUserLogin,helpUserPassword); > > showPage(helpUserLogin,helpUserPassword); > > > > > > > > > daisy-request@... schrieb: > > > > I'm not sure what you are asking. Did you try the obvious? > > i.e. I am starting to feel like a helpdesk, this is not how things work > > here. Please show me that you did at least some research, preferably > > by showing what code you already have, indicating what does work, what > > does not work, why you think it does not work, what do you expect your > > code to do, what it actually does etc etc. > > > > Here is something that may you get started with scripting the > > repository: > > > > http://cocoondev.org/daisydocs-1_3/repository/interfaces/153-cd.html > > > > Karel > > > > On Thu, 2008-06-26 at 17:48 +0200, Valerie Nyre wrote: > > > >> Dear experts > >> > >> Yes - thanks - it is possible to use Javascript flow to access URL > >> parameters and update user roles. > >> > >> Question: > >> Is it possible to use a JavaScript flow to automatically change the user > >> login? > >> > >> > >> > >> Thank you > >> > >> Valerie Nyre > >> Maas High Tech Software > >> > >> > >> > >> > > _______________________________________________ > daisy community mailing list > Professional Daisy support: http://outerthought.org/en/services/daisy/support.html > mail to: daisy@... > list information: http://lists.cocoondev.org/mailman/listinfo/daisy daisy community mailing list Professional Daisy support: http://outerthought.org/en/services/daisy/support.html mail to: daisy@... list information: http://lists.cocoondev.org/mailman/listinfo/daisy |
|
|
|
|
|
|
| Free Forum Powered by Nabble | Forum Help |