KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /usr/lib64/python2.4/site-packages/sabayon/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib64/python2.4/site-packages/sabayon/userdb.pyc
mò
»fEOc@sûdkZdkZdkZdkZdkZdkZdkZdkZdkZdk	Z	dk
Z
dZeiƒd„Z
eed„Zd„Zdefd„ƒYZdfd„ƒYZead	„Zd
„ZedjoeiƒeƒndS(Ns.<profiles>
  <default profile=""/>
</profiles>cGstiti||ƒdS(N(tutiltdebug_printtDEBUG_USERDBtfmttargs(RR((t4/usr/lib64/python2.4/site-packages/sabayon/userdb.pytdprint(scCs[|i|ƒ}|oAy||iƒSWqWttdƒ||iƒfƒ‚qWXn|S(Ns!invalid type for setting %s in %s(
tnodethasProptsettingtat
convert_totcontenttUserDatabaseExceptiont_tnodePathtdefault(RR	RRR
((Rtget_setting,s*cCs±d}d}xž|t|ƒjoŠ||}|d}|djo[|t|ƒjoD||}|djo||jo||}qŒn|d}qžn||}qW|S(Ntiit%(trestitlentstringtctattrs(RRRRR((Rt
expand_string5s





R
cBstZRS(N(t__name__t
__module__(((RR
FstUserDatabasecBs‰tZdZed„Zd„Zd„Zd„Zd„Ze	d„Z
e	ed„Zed„Z
d	„Zd
„Zd„Zd„ZRS(
sÂAn encapsulation of the database which maintains an
    association between users and profiles.

    This database is stored by default in
    $(sysconfdir)/desktop-profiles/users.xml and contains a
    list of users and the profile associated with each of
    those users.

    A profile can be reference by either its name (in which case
    the profile is stored at /etc/desktop-profiles/$(name).zip),
    an absolute path or a http/file URL.
    cCs|djotiitidƒ}n4|ddjotiiti|ƒ}n|}||_d|_	t
d|iƒy,ti|dti
ƒ|_|iiƒWn!t
d|iƒd|_nX|idjo+titttƒddti
ƒ|_ndS(sáCreate a UserDatabase object.

        @db_file: an (optional) path which specifes the location
        of the database file. If not specified, the default
        location of /etc/desktop-profiles/users.xml is used.
        s	users.xmlit/sNew UserDatabase(%s) object
s0failed to parse %s falling back to default conf
N(tdb_filetNonetostpathtjointconfigtPROFILESDIRtfiletselftmodifiedRtlibxml2treadFiletXML_PARSE_NOBLANKStdoctxincludeProcesst
readMemorytdefaultConfR(R'RR&((Rt__init__Vs&
		
cCs%|idjo|iiƒndS(N(R'R,R tfreeDoc(R'((Rt__del__uscCs|pdSn|idhd|<dtiƒ<ƒ}|o|Sn|}yt|ƒ}Wnt
i|dƒ}nX|djo´y¦|i
dƒ}|djo†|djoy|tiitidƒjoZt
i||ƒ}|ddjot
i|t|ƒdƒ}ntd	||ƒ|SnWq;q;Xny|t
i|ƒ}|iƒdjoP|ddjotiiti|ƒ}n|d
djo|d}q¶n|}Wn
d}nX|ddjot
i|t|ƒdƒ}ntd	||ƒ|S(Ntlocationmaptpths/:Rs	users.xmliRs-Converted profile name '%s' to location '%s'
iüÿÿÿs.zip(tprofileR R't_UserDatabase__ldap_querytsockettgetfqdnturitorig_profiletparseURIttmpR)tURIEscapeStrRtgetBasetbaseR!R"R#R$R%tbuildURItrettURIUnescapeStringRRtscheme(R'R6RR:RBR;R@R=((Rt__profile_name_to_locationysJ*
9



cCsï|iidƒ}t|ƒdjodSn|d}t|ddƒ}t|dt	i
tƒ}t	i
||ƒ}t|dt	itƒ|_t|ddtƒ|_t|d	d
ƒ}t|dd
ƒ}|d
jo|i||ƒn|S(Ns/profiles/ldapitservert	localhosttporttversionttimeouti
tbind_dnRtbind_pw(R'R,t	xpathEvaltnodesRR t	ldap_nodeRRFtldaptPORTtintRHtopentltVERSION3tprotocol_versionRJRKRLtsimple_bind(R'RTRFRORKRLRNRH((Rt__open_ldap¬s

cCsk|iid|ƒ}t|ƒdjodSn|d}|iƒ}|pdSnt
|dƒ}	t
|dƒ}t
|dƒ}t
|ddƒ}t
|dd	ƒ}
|	djottd
|ƒƒ‚n|djottd|ƒƒ‚n|djottd|ƒƒ‚n|djo
ti}nG|d
jo
ti}n-|djo
ti}nttdƒƒ‚t||ƒ}t|	|ƒ}	|i|	|||gƒ}
t|
ƒdjodSn|
d\}}||jodSn||}|
d	jo|d}nD|
djo$|tidt|ƒdƒ}nttdƒƒ‚|i ƒ|S(Ns/profiles/ldap/itsearch_basetquery_filtertresult_attributetscopetsubtmultiple_resulttfirsts No search based specified for %ss No query filter specified for %ss$No result attribute specified for %sR@tones&Scope must be one of sub, base and onetrandomis/multiple_result must be one of first and random(!R'R,RMtmapRNRR tmap_nodet_UserDatabase__open_ldapRTRRYRZR[R\R^R
RRPt
SCOPE_SUBTREEt
SCOPE_BASEtSCOPE_ONELEVELRtreplacetsearch_stresultstdnRtvalstvalRatrandinttunbind(R'RbRhRkRcRZRR[RmRYR^R\RNRjRlRT((Rt__ldap_queryÁsR













$
cCs^d}y)|iidƒd}|idƒ}Wn
d}nX|p|Sn|i||ƒS(sULook up the default profile.

        @profile_location: whether the profile location should
        be returned

        Return value: the location of the default profile, which
        should be in a suitable form for constructing a ProfileStorage
        object, or the default profile name if @profile_location is
        False.
        s/profiles/defaultiR6N(	R RR'R,RMtpropR6tprofile_locationt'_UserDatabase__profile_name_to_location(R'RrRR6((Rtget_default_profileüs

cCsðd}|idhd|<dtiƒ<ƒ}|pGy3d|}|i	i
|ƒd}|idƒ}Wq~d}q~Xn|oK|oCy/d}|i	i
|ƒd}|idƒ}WqÑd}qÑXn|p|Sn|i||ƒS(	sLook up the profile for a given username.

        @username: the user whose profile location should be
        returned.
        @profile_location: whether the profile location should
        be returned
        @ignore_default: don't use the default profile if
        no profile is explicitly set.

        Return value: the location of the profile, which
        should be in a suitable form for constructing a
        ProfileStorage object, or the profile name if
        @profile_location is False.
        t
profilemaptuR5s/profiles/user[@name='%s']iR6s/profiles/default[1][@profile]N(R tuserR'R7tusernameR8R9R6tqueryR,RMRqtignore_defaultRrRs(R'RxRrRzR6RwRy((Rtget_profiles(*
cCs||djo
|i}ntd|ƒyti||dƒd}Wn
d}nXyt|dƒ}Wnj|djo@y%ti|d|ƒtd|ƒWq»td|ƒq»Xnt
tdƒ|ƒ‚nXy-|i|i
id	d
dƒƒ|iƒWnj|djo@y%ti|d|ƒtd|ƒWqUtd|ƒqUXnt
tdƒ|ƒ‚nXd|_dS(
s.Save the current version to the given filenamesSaving UserDatabase to %s
s.bakiitwsRestore from %s.bak
sFailed to restore from %s.bak
sCould not open %s for writingsUTF-8tformats!Failed to save UserDatabase to %sN(tfilenameR R'R&RR!trenametbackupRStfR
RtwriteR,t	serializetcloseR((R'R~RR€((Rt	__save_as9s@





cCs.|d
jo
d}nd|_yS|iidƒd}|idƒ}||jo|i	d|ƒd|_nWn–y|iidƒd}Wn ttdƒ|i
ƒ‚nXy)|id
dd
ƒ}|i	d|ƒWnttd	ƒ|ƒ‚nXd|_nX|idjo|iƒnd
S(sjSet the default profile to be used for all users.

        @profile: the location of the profile.
        Ris/profiles/defaultR6is	/profiless&File %s is not a profile configurationRs1Failed to add default profile %s to configurationN(R6R R'R(R,RMRRqt
oldprofiletsetProptprofilesR
RR&tnewChildt_UserDatabase__save_as(R'R6R†RRˆ((Rtset_default_profilebs.

	

cCsH|djo
d}nd|_y]d|}|ii|ƒd}|i	dƒ}||jo|id|ƒd|_nWn¦y|iidƒd}Wn t
tdƒ|iƒ‚nXy9|idddƒ}|id	|ƒ|id|ƒWnt
td
ƒ|ƒ‚nXd|_nX|idjo|iƒndS(s¨Set the profile for a given username.

        @username: the user whose profile location should be
        set.
        @profile: the location of the profile.
        Ris/profiles/user[@name='%s']R6is	/profiless&File %s is not a profile configurationRwtnames.Failed to add user %s to profile configurationN(R6R R'R(RxRyR,RMRwRqR†R‡RˆR
RR&R‰RŠ(R'RxR6RˆRwR†Ry((Rtset_profile‚s2

	


cCsrg}yMxFtitiƒD]2}|ddjoqn|i|dd!ƒqWWntdtiƒnX|S(s­Return the list of currently available profiles.
        This is basically just list of zip files in
        /etc/desktop-profiles, each without the .zip extension.
        iüÿÿÿs.zipisFailed to read directory(%s)
N(tlistR!tlistdirR$R%R&tappendR(R'RŽR&((Rtget_profiles¦scCsÑg}ytiƒ}Wnttdƒƒ‚nXx˜tiƒD]Š}yz|ddjow?n|d|jow?n|ddjpti|ddƒdjow?n|i	|dƒWq?q?Xq?W|S(
s£Return the list of users on the system. These should
        be real users - i.e. should not include system users
        like nobody, gdm, nfsnobody etc.
        sFailed to get the user listiiôiiRtnologiniÿÿÿÿN(
RŽtpwdtgetpwalltusersR
RRwRtfindR(R'R•RŽRw((Rt	get_users¶s&
.(RRt__doc__R R0R2RsRdR7tTrueRttFalseR{RŠR‹RR‘R—(((RRIs		3		;&)	 	$	cCstdjo
tƒantS(sReturn a UserDatabase singletonN(t
user_databaseR R(((Rtget_databaseÒs


cCsd}yti|ƒWnnXt|ƒ}|idƒ|idtƒ}|dj	pt
‚|djpt
‚|iddƒ|idƒ}|dj	pt
‚|ddjpt
‚|iddƒ|idƒ}|dj	pt
‚|ddjpt
‚dS(	Ns/tmp/test_users.xmlRt	localusertgroupAiäÿÿÿs/desktop-profiles/groupA.ziptgroupBs/desktop-profiles/groupB.zip(ttestfileR!tunlinkRtdbR‹R{RšRR tAssertionErrorR(RR¢R ((Rtrun_unit_testsÜs$
t__main__(tsysRR“R!R)R$RtcacheRaRPR8R/t
initializeRR tstrRRt	ExceptionR
RR›RœR¤Rtinit_gettext(R)RaRRR¤R§RœRPR$R
RR/RR“RRR¦R8R!((Rt?s0											
			ÿ‰	
	



Anon7 - 2021