[Gambas-user] Access global variable from other .class

tobi tobiasboege01 at ...1601...
Fri Jun 15 20:47:40 CEST 2012


On Fri, 15 Jun 2012, Jussi Lahtinen wrote:
> Weird that there isn't any standard about this, or is there..?
> I think every linux distribution should have link to it's graphical version
> of sudo/su, with uniform name like GUIsudo.
> Then you could always call it without knowing which environment is used.
> 
> Jussi
> 
> 
> 
> 
> On 14 June 2012 07:58, Bruce <bbruen at ...2308...> wrote:
> 
> > On Thu, 2012-06-14 at 04:28 +0000, sundar j wrote:
> > > I am trying to write a code for accepting user password in a input
> > box/textbox when user click on button from main form. For user input i have
> > created new form named sudo.form and codes are in sudo.class file. This
> > sudo.class accepts user password through textbox (hidden) and store it in
> > global variable named password. sudo form is shown when user click on
> > button from main form. Now my problem is that how do i access/capture this
> > global variable (password) from main program? For example, accessing module
> > variable (from sudo.module) we do it like:
> > >
> > > Public Sub function()
> > > Dim accept as string
> > > .
> > > .
> > > accept = sudo.password
> > > Shell "echo " & accept & " | sudo -S somecommand"
> > > .
> > > .
> > > End
> > >
> > > Right now i do not have a code to post but will come back later. But the
> > general idea which i am trying to do is explained above.
> >
> > Why not save yourself the bother and just use kdesu, kdesudo, gksu,
> > gksudo or pkexec (whichever fits your distro).
> >
> > As in, for example:
> >
> >        Shell "gksu -c somecommand"
> >
> >
> > These all provide the privilege gui and probably much more security than
> > redoing it yourself.
> >
> > hth
> > Bruce
> >
> >
> >
> > ------------------------------------------------------------------------------
> > Live Security Virtual Conference
> > Exclusive live event will cover all the ways today's security and
> > threat landscape has changed and how IT managers can respond. Discussions
> > will include endpoint security, mobile security and the latest in malware
> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

If I remember correctly, you can even save more work by using gb.desktop, Desktop.RunAsRoot() which
builds on top of the portland xdg scripts.

Regards,
Tobi




More information about the User mailing list