rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
descr='''Add a profil and check if it has been affected to a new user (avoid | descr='''Add a profil and check if it has been affected to a new ''' '''user (avoid | def chk_acls_cmds(dir): return [ 'getfacl', '-R', dir ] | 38a496a61795ec7fb8b2f6589579ac75d0b90d9d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/38a496a61795ec7fb8b2f6589579ac75d0b90d9d/core.py |
descr='check add user with --firstname and --lastname (avoid | descr='''check add user with --firstname and --lastname (avoid ''' | def chk_acls_cmds(dir): return [ 'getfacl', '-R', dir ] | 38a496a61795ec7fb8b2f6589579ac75d0b90d9d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/38a496a61795ec7fb8b2f6589579ac75d0b90d9d/core.py |
descr='''(avoid | descr='''avoid | def chk_acls_cmds(dir): return [ 'getfacl', '-R', dir ] | 38a496a61795ec7fb8b2f6589579ac75d0b90d9d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/38a496a61795ec7fb8b2f6589579ac75d0b90d9d/core.py |
def chk_acls_cmds(dir): return [ 'getfacl', '-R', dir ] | 38a496a61795ec7fb8b2f6589579ac75d0b90d9d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/38a496a61795ec7fb8b2f6589579ac75d0b90d9d/core.py |
||
def chk_acls_cmds(dir): return [ 'getfacl', '-R', dir ] | 38a496a61795ec7fb8b2f6589579ac75d0b90d9d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/38a496a61795ec7fb8b2f6589579ac75d0b90d9d/core.py |
||
def test_imports(context): pname = 'profil_test' ScenarioTest([ ADD + [ 'profile', pname, '-v' ], ADD + [ 'users', '--filename=data/tests_users.csv', '--profile=%s' % pname ], ADD + [ 'users', '--filename=data/tests_users.csv', '--profile=%s' % pname, '--confirm-import' ], GET + [ 'users', '-l' ], GET + [ 'profiles' ], DEL + [ 'profiles', pname, '--del-users', '--no-archive' ], GET + [ 'users', '-l' ], GET + [ 'profiles' ], DEL + [ 'group', '--empty', '--no-archive', '-v' ], ], context=context, descr='''test user import from csv file''' ).Run() ScenarioTest([ ADD + [ 'profile', pname, '-v' ], ADD + [ 'users', '--filename=data/tests_users.csv', '--profile=%s' % pname, '--lastname-column=0', '--firstname-column=1' ], ADD + [ 'users', '--filename=data/tests_users.csv', '--profile=%s' % pname, '--lastname-column=1', '--firstname-column=0', '--group-column=2', '--password-column=3', '--confirm-import', '-v' ], GET + [ 'users' ], DEL + [ 'profiles', pname, '--del-users', '--no-archive', '-v' ], DEL + [ 'group', 'cp,ce1,ce2,cm2', '--no-archive', '-v' ], ], context=context, descr='''various test on user import''' ).Run() """ os.system(DEL + " profile --group utilisagers --del-users --no-archive") os.system(DEL + " profile --group responsibilisateurs --del-users --no-archive") log_and_exec(GET + " groups --empty | cut -d\":\" -f 1 | xargs -I% " + DEL + " group --name % --no-archive") log_and_exec(ADD + " profile --name Utilisagers --group utilisagers --comment 'profil normal créé pour la suite de tests utilisateurs'") log_and_exec(ADD + " profile --name Responsibilisateurs --group responsibilisateurs --groups cdrom,lpadmin,plugdev,audio,video,scanner,fuse --comment 'profil power user créé pour la suite de tests utilisateurs.'") log_and_exec(ADD + " users --filename ./testsuite/tests_users.csv", True, 12, comment = "You should specify a profile") log_and_exec(ADD + " users --filename ./testsuite/tests_users.csv --profile utilisagers") log_and_exec(ADD + " users --filename ./testsuite/tests_users.csv --profile utilisagers --lastname-column 1 --firstname-column 0") log_and_exec("time " + ADD + " users --filename ./testsuite/tests_users.csv --profile utilisagers --lastname-column 1 --firstname-column 0 --confirm-import") log_and_exec(ADD + " users --filename ./testsuite/tests_resps.csv --profile responsibilisateurs") log_and_exec(ADD + " users --filename ./testsuite/tests_resps.csv --profile responsibilisateurs --lastname-column 1 --firstname-column 0") log_and_exec("time " + ADD + " users --filename ./testsuite/tests_resps.csv --profile responsibilisateurs --lastname-column 1 --firstname-column 0 --confirm-import") # activer les 2 lignes suivantes pour importer 860 utilisateurs de Latresne... log_and_exec(ADD + " users --filename ./testsuite/tests_users2.csv --profile utilisagers") log_and_exec("time " + ADD + " users --filename ./testsuite/tests_users2.csv --profile utilisagers --confirm-import") os.system("sleep 5") log_and_exec(DEL + " profile --group utilisagers --del-users --no-archive") log_and_exec(DEL + " profile --group responsibilisateurs --del-users --no-archive") log_and_exec(GET + " groups --empty | cut -d\":\" -f 1 | xargs -I% " + DEL + " group --name % --no-archive") """ | 38a496a61795ec7fb8b2f6589579ac75d0b90d9d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/38a496a61795ec7fb8b2f6589579ac75d0b90d9d/core.py |
||
descr='check if a error occurs when a non-existing group is added to a profile' | descr='''check if a error occurs when a non-existing group is added ''' '''to a profile''' | def chk_acls_cmd(user): return [ 'getfacl', '-R', '%s/%s' % ( configuration.users.base_path, user) ] | 38a496a61795ec7fb8b2f6589579ac75d0b90d9d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/38a496a61795ec7fb8b2f6589579ac75d0b90d9d/core.py |
descr='test short users/groups commands' | descr='''test short users/groups commands''' | def test_short_syntax(): uname = 'user_test' gname = 'group_test' pname = 'profil_test' ScenarioTest([ ADD + [ 'user', uname, '-v' ], GET + [ 'user', uname ], ADD + [ 'group', gname, '-v' ], GET + [ 'group', gname ], ADD + [ 'user', uname, gname, '-v' ], GET + [ 'user', uname, '-l' ], ADD + [ 'group', '%s2' % gname, '-v' ], GET + [ 'group', '%s2' % gname ], ADD + [ 'group', '%s3,%s4' % (gname, gname), '-v' ], # should fail (already present) GET + [ 'group', '%s3,%s4' % (gname, gname) ], # should add user2 & user3 ADD + [ 'user', '%s2,%s3' % (uname, uname), '-v' ], GET + [ 'user', '%s2,%s3' % (uname, uname) ], # add 2 users in 3 groups each ADD + [ 'user', '%s2,%s3' % (uname, uname), '%s2,%s3,%s4' % (gname,gname,gname), '-v' ], GET + [ 'user', '%s2,%s3' % (uname, uname), '-l' ], # should add ONLY ONE user in a group and bypass empty one ADD + [ 'user', ',%s' % uname, ',%s2' % gname, '-v' ], # idem ADD + [ 'user', '%s,' % uname, '%s3,' % gname, '-v' ], GET + [ 'user', uname, '-l' ], # should delete only one user and bypass empty one DEL + [ 'user', ',%s' % uname, '-v'], # should fail (already deleted) DEL + [ 'user', '%s,' % uname, '-v'], # IDEM DEL + [ 'user', uname, '-v'], # delete 2 users at same time DEL + [ 'user', '%s2,%s3' % (uname, uname), '-v'], # delete groups, one, then two, then one (bypassing empty) DEL + [ 'group', gname, '-v'], DEL + [ 'group', '%s2,%s3' % (gname, gname), '-v'], DEL + [ 'group', ',%s4' % gname, '-v'], DEL + [ 'group', '%s4,' % gname, '-v'], DEL + [ 'group', '%s4' % gname, '-v'], ], descr='test short users/groups commands' ).Run() ScenarioTest([ ADD + [ 'group', gname, '-v' ], #should fail (the group is not a system group) ADD + [ 'privilege', gname, '-v' ], GET + [ 'privileges' ], ADD + [ 'group', '%ssys' % gname, '--system', '-v' ], ADD + [ 'privilege', '%ssys' % gname, '-v' ], GET + [ 'privileges' ], DEL + [ 'privilege', '%ssys' % gname ], GET + [ 'privileges' ], DEL + [ 'group', gname ], DEL + [ 'group', '%ssys' % gname ], ], descr='test short privileges commands' ).Run() ScenarioTest([ ADD + [ 'group', gname, '--system', '-v' ], ADD + [ 'group', '%s2' % gname, '-v' ], ADD + [ 'group', '%s3' % gname, '-v' ], # should fail (not a system group) ADD + [ 'profile', pname, '--group=%s2' % gname, '--force-existing' ], GET + [ 'profiles' ], # should be OK ADD + [ 'profile', pname, '--group=%s' % gname, '--force-existing' ], GET + [ 'profiles' ], MOD + [ 'profile', pname, '--add-groups=%s2,%s3' % (gname,gname) ], GET + [ 'profiles' ], MOD + [ 'profile', pname, '--del-groups=%s2,%s3' % (gname,gname) ], GET + [ 'profiles' ], DEL + [ 'profile', pname ], DEL + [ 'group', '%s2' % gname, '-v' ], DEL + [ 'group', '%s3' % gname, '-v' ], GET + [ 'profiles' ], ], descr='test short profiles commands' ).Run() ScenarioTest([ ADD + [ 'group', gname, '-v' ], ADD + [ 'group', '%s2' % gname, '-v' ], CHK + [ 'group', gname, '--auto-no', '-vv' ], CHK + [ 'group', gname, '--auto-yes', '-vv' ], CHK + [ 'group', gname, '-vb' ], CHK + [ 'group', '%s,%s2' % (gname,gname), '--auto-no', '-vv' ], CHK + [ 'group', '%s,%s2' % (gname,gname), '--auto-yes', '-vv' ], CHK + [ 'group', '%s,%s2' % (gname,gname), '-vb' ], DEL + [ 'group', '%s,%s2' % (gname,gname), '-v' ], CHK + [ 'config','--auto-no', '-vvae' ], CHK + [ 'config','--auto-yes', '-vvae' ], CHK + [ 'config','--batch', '-vvae' ], ADD + [ 'user', uname, '-v' ], CHK + [ 'user', uname, '--auto-no', '-v' ], CHK + [ 'user', uname, '--auto-yes', '-v' ], CHK + [ 'user', uname, '-vb' ], DEL + [ 'user', uname, '-v' ], ], descr='test short chk commands' ).Run() """ # extended check on user not implemented yet CHK + [ 'user', '%s,%s2' % (uname,uname), '--auto-no', '-vve' ], CHK + [ 'user', '%s,%s2' % (uname,uname), '--auto-yes', '-vve' ], CHK + [ 'user', '%s,%s2' % (uname,uname), '--batch', '-vve' ], DEL + [ 'user', '%s,%s2' % (uname,uname), '-v' ], # check on profile not implemented yet ADD + [ 'profile', '%s,%s2' % (pname,pname), '-v' ], CHK + [ 'profile', pname, '--auto-no', '-vve' ], CHK + [ 'profile', pname, '--auto-yes', '-vve' ], CHK + [ 'profile', pname, '--batch', '-vve' ], CHK + [ 'profile', '%s,%s2' % (pname,pname), '--auto-no', '-vve' ], CHK + [ 'profile', '%s,%s2' % (pname,pname), '--auto-yes', '-vve' ], CHK + [ 'profile', '%s,%s2' % (pname,pname), '--batch', '-vve' ], DEL + [ 'profile', '%s,%s2' % (pname,pname), '-v' ], """ | 38a496a61795ec7fb8b2f6589579ac75d0b90d9d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/38a496a61795ec7fb8b2f6589579ac75d0b90d9d/core.py |
descr='test short privileges commands' | descr='''test short privileges commands''' | def test_short_syntax(): uname = 'user_test' gname = 'group_test' pname = 'profil_test' ScenarioTest([ ADD + [ 'user', uname, '-v' ], GET + [ 'user', uname ], ADD + [ 'group', gname, '-v' ], GET + [ 'group', gname ], ADD + [ 'user', uname, gname, '-v' ], GET + [ 'user', uname, '-l' ], ADD + [ 'group', '%s2' % gname, '-v' ], GET + [ 'group', '%s2' % gname ], ADD + [ 'group', '%s3,%s4' % (gname, gname), '-v' ], # should fail (already present) GET + [ 'group', '%s3,%s4' % (gname, gname) ], # should add user2 & user3 ADD + [ 'user', '%s2,%s3' % (uname, uname), '-v' ], GET + [ 'user', '%s2,%s3' % (uname, uname) ], # add 2 users in 3 groups each ADD + [ 'user', '%s2,%s3' % (uname, uname), '%s2,%s3,%s4' % (gname,gname,gname), '-v' ], GET + [ 'user', '%s2,%s3' % (uname, uname), '-l' ], # should add ONLY ONE user in a group and bypass empty one ADD + [ 'user', ',%s' % uname, ',%s2' % gname, '-v' ], # idem ADD + [ 'user', '%s,' % uname, '%s3,' % gname, '-v' ], GET + [ 'user', uname, '-l' ], # should delete only one user and bypass empty one DEL + [ 'user', ',%s' % uname, '-v'], # should fail (already deleted) DEL + [ 'user', '%s,' % uname, '-v'], # IDEM DEL + [ 'user', uname, '-v'], # delete 2 users at same time DEL + [ 'user', '%s2,%s3' % (uname, uname), '-v'], # delete groups, one, then two, then one (bypassing empty) DEL + [ 'group', gname, '-v'], DEL + [ 'group', '%s2,%s3' % (gname, gname), '-v'], DEL + [ 'group', ',%s4' % gname, '-v'], DEL + [ 'group', '%s4,' % gname, '-v'], DEL + [ 'group', '%s4' % gname, '-v'], ], descr='test short users/groups commands' ).Run() ScenarioTest([ ADD + [ 'group', gname, '-v' ], #should fail (the group is not a system group) ADD + [ 'privilege', gname, '-v' ], GET + [ 'privileges' ], ADD + [ 'group', '%ssys' % gname, '--system', '-v' ], ADD + [ 'privilege', '%ssys' % gname, '-v' ], GET + [ 'privileges' ], DEL + [ 'privilege', '%ssys' % gname ], GET + [ 'privileges' ], DEL + [ 'group', gname ], DEL + [ 'group', '%ssys' % gname ], ], descr='test short privileges commands' ).Run() ScenarioTest([ ADD + [ 'group', gname, '--system', '-v' ], ADD + [ 'group', '%s2' % gname, '-v' ], ADD + [ 'group', '%s3' % gname, '-v' ], # should fail (not a system group) ADD + [ 'profile', pname, '--group=%s2' % gname, '--force-existing' ], GET + [ 'profiles' ], # should be OK ADD + [ 'profile', pname, '--group=%s' % gname, '--force-existing' ], GET + [ 'profiles' ], MOD + [ 'profile', pname, '--add-groups=%s2,%s3' % (gname,gname) ], GET + [ 'profiles' ], MOD + [ 'profile', pname, '--del-groups=%s2,%s3' % (gname,gname) ], GET + [ 'profiles' ], DEL + [ 'profile', pname ], DEL + [ 'group', '%s2' % gname, '-v' ], DEL + [ 'group', '%s3' % gname, '-v' ], GET + [ 'profiles' ], ], descr='test short profiles commands' ).Run() ScenarioTest([ ADD + [ 'group', gname, '-v' ], ADD + [ 'group', '%s2' % gname, '-v' ], CHK + [ 'group', gname, '--auto-no', '-vv' ], CHK + [ 'group', gname, '--auto-yes', '-vv' ], CHK + [ 'group', gname, '-vb' ], CHK + [ 'group', '%s,%s2' % (gname,gname), '--auto-no', '-vv' ], CHK + [ 'group', '%s,%s2' % (gname,gname), '--auto-yes', '-vv' ], CHK + [ 'group', '%s,%s2' % (gname,gname), '-vb' ], DEL + [ 'group', '%s,%s2' % (gname,gname), '-v' ], CHK + [ 'config','--auto-no', '-vvae' ], CHK + [ 'config','--auto-yes', '-vvae' ], CHK + [ 'config','--batch', '-vvae' ], ADD + [ 'user', uname, '-v' ], CHK + [ 'user', uname, '--auto-no', '-v' ], CHK + [ 'user', uname, '--auto-yes', '-v' ], CHK + [ 'user', uname, '-vb' ], DEL + [ 'user', uname, '-v' ], ], descr='test short chk commands' ).Run() """ # extended check on user not implemented yet CHK + [ 'user', '%s,%s2' % (uname,uname), '--auto-no', '-vve' ], CHK + [ 'user', '%s,%s2' % (uname,uname), '--auto-yes', '-vve' ], CHK + [ 'user', '%s,%s2' % (uname,uname), '--batch', '-vve' ], DEL + [ 'user', '%s,%s2' % (uname,uname), '-v' ], # check on profile not implemented yet ADD + [ 'profile', '%s,%s2' % (pname,pname), '-v' ], CHK + [ 'profile', pname, '--auto-no', '-vve' ], CHK + [ 'profile', pname, '--auto-yes', '-vve' ], CHK + [ 'profile', pname, '--batch', '-vve' ], CHK + [ 'profile', '%s,%s2' % (pname,pname), '--auto-no', '-vve' ], CHK + [ 'profile', '%s,%s2' % (pname,pname), '--auto-yes', '-vve' ], CHK + [ 'profile', '%s,%s2' % (pname,pname), '--batch', '-vve' ], DEL + [ 'profile', '%s,%s2' % (pname,pname), '-v' ], """ | 38a496a61795ec7fb8b2f6589579ac75d0b90d9d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/38a496a61795ec7fb8b2f6589579ac75d0b90d9d/core.py |
descr='test short profiles commands' | descr='''test short profiles commands''' | def test_short_syntax(): uname = 'user_test' gname = 'group_test' pname = 'profil_test' ScenarioTest([ ADD + [ 'user', uname, '-v' ], GET + [ 'user', uname ], ADD + [ 'group', gname, '-v' ], GET + [ 'group', gname ], ADD + [ 'user', uname, gname, '-v' ], GET + [ 'user', uname, '-l' ], ADD + [ 'group', '%s2' % gname, '-v' ], GET + [ 'group', '%s2' % gname ], ADD + [ 'group', '%s3,%s4' % (gname, gname), '-v' ], # should fail (already present) GET + [ 'group', '%s3,%s4' % (gname, gname) ], # should add user2 & user3 ADD + [ 'user', '%s2,%s3' % (uname, uname), '-v' ], GET + [ 'user', '%s2,%s3' % (uname, uname) ], # add 2 users in 3 groups each ADD + [ 'user', '%s2,%s3' % (uname, uname), '%s2,%s3,%s4' % (gname,gname,gname), '-v' ], GET + [ 'user', '%s2,%s3' % (uname, uname), '-l' ], # should add ONLY ONE user in a group and bypass empty one ADD + [ 'user', ',%s' % uname, ',%s2' % gname, '-v' ], # idem ADD + [ 'user', '%s,' % uname, '%s3,' % gname, '-v' ], GET + [ 'user', uname, '-l' ], # should delete only one user and bypass empty one DEL + [ 'user', ',%s' % uname, '-v'], # should fail (already deleted) DEL + [ 'user', '%s,' % uname, '-v'], # IDEM DEL + [ 'user', uname, '-v'], # delete 2 users at same time DEL + [ 'user', '%s2,%s3' % (uname, uname), '-v'], # delete groups, one, then two, then one (bypassing empty) DEL + [ 'group', gname, '-v'], DEL + [ 'group', '%s2,%s3' % (gname, gname), '-v'], DEL + [ 'group', ',%s4' % gname, '-v'], DEL + [ 'group', '%s4,' % gname, '-v'], DEL + [ 'group', '%s4' % gname, '-v'], ], descr='test short users/groups commands' ).Run() ScenarioTest([ ADD + [ 'group', gname, '-v' ], #should fail (the group is not a system group) ADD + [ 'privilege', gname, '-v' ], GET + [ 'privileges' ], ADD + [ 'group', '%ssys' % gname, '--system', '-v' ], ADD + [ 'privilege', '%ssys' % gname, '-v' ], GET + [ 'privileges' ], DEL + [ 'privilege', '%ssys' % gname ], GET + [ 'privileges' ], DEL + [ 'group', gname ], DEL + [ 'group', '%ssys' % gname ], ], descr='test short privileges commands' ).Run() ScenarioTest([ ADD + [ 'group', gname, '--system', '-v' ], ADD + [ 'group', '%s2' % gname, '-v' ], ADD + [ 'group', '%s3' % gname, '-v' ], # should fail (not a system group) ADD + [ 'profile', pname, '--group=%s2' % gname, '--force-existing' ], GET + [ 'profiles' ], # should be OK ADD + [ 'profile', pname, '--group=%s' % gname, '--force-existing' ], GET + [ 'profiles' ], MOD + [ 'profile', pname, '--add-groups=%s2,%s3' % (gname,gname) ], GET + [ 'profiles' ], MOD + [ 'profile', pname, '--del-groups=%s2,%s3' % (gname,gname) ], GET + [ 'profiles' ], DEL + [ 'profile', pname ], DEL + [ 'group', '%s2' % gname, '-v' ], DEL + [ 'group', '%s3' % gname, '-v' ], GET + [ 'profiles' ], ], descr='test short profiles commands' ).Run() ScenarioTest([ ADD + [ 'group', gname, '-v' ], ADD + [ 'group', '%s2' % gname, '-v' ], CHK + [ 'group', gname, '--auto-no', '-vv' ], CHK + [ 'group', gname, '--auto-yes', '-vv' ], CHK + [ 'group', gname, '-vb' ], CHK + [ 'group', '%s,%s2' % (gname,gname), '--auto-no', '-vv' ], CHK + [ 'group', '%s,%s2' % (gname,gname), '--auto-yes', '-vv' ], CHK + [ 'group', '%s,%s2' % (gname,gname), '-vb' ], DEL + [ 'group', '%s,%s2' % (gname,gname), '-v' ], CHK + [ 'config','--auto-no', '-vvae' ], CHK + [ 'config','--auto-yes', '-vvae' ], CHK + [ 'config','--batch', '-vvae' ], ADD + [ 'user', uname, '-v' ], CHK + [ 'user', uname, '--auto-no', '-v' ], CHK + [ 'user', uname, '--auto-yes', '-v' ], CHK + [ 'user', uname, '-vb' ], DEL + [ 'user', uname, '-v' ], ], descr='test short chk commands' ).Run() """ # extended check on user not implemented yet CHK + [ 'user', '%s,%s2' % (uname,uname), '--auto-no', '-vve' ], CHK + [ 'user', '%s,%s2' % (uname,uname), '--auto-yes', '-vve' ], CHK + [ 'user', '%s,%s2' % (uname,uname), '--batch', '-vve' ], DEL + [ 'user', '%s,%s2' % (uname,uname), '-v' ], # check on profile not implemented yet ADD + [ 'profile', '%s,%s2' % (pname,pname), '-v' ], CHK + [ 'profile', pname, '--auto-no', '-vve' ], CHK + [ 'profile', pname, '--auto-yes', '-vve' ], CHK + [ 'profile', pname, '--batch', '-vve' ], CHK + [ 'profile', '%s,%s2' % (pname,pname), '--auto-no', '-vve' ], CHK + [ 'profile', '%s,%s2' % (pname,pname), '--auto-yes', '-vve' ], CHK + [ 'profile', '%s,%s2' % (pname,pname), '--batch', '-vve' ], DEL + [ 'profile', '%s,%s2' % (pname,pname), '-v' ], """ | 38a496a61795ec7fb8b2f6589579ac75d0b90d9d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/38a496a61795ec7fb8b2f6589579ac75d0b90d9d/core.py |
descr='test short chk commands' | descr='''test short chk commands''' | def test_short_syntax(): uname = 'user_test' gname = 'group_test' pname = 'profil_test' ScenarioTest([ ADD + [ 'user', uname, '-v' ], GET + [ 'user', uname ], ADD + [ 'group', gname, '-v' ], GET + [ 'group', gname ], ADD + [ 'user', uname, gname, '-v' ], GET + [ 'user', uname, '-l' ], ADD + [ 'group', '%s2' % gname, '-v' ], GET + [ 'group', '%s2' % gname ], ADD + [ 'group', '%s3,%s4' % (gname, gname), '-v' ], # should fail (already present) GET + [ 'group', '%s3,%s4' % (gname, gname) ], # should add user2 & user3 ADD + [ 'user', '%s2,%s3' % (uname, uname), '-v' ], GET + [ 'user', '%s2,%s3' % (uname, uname) ], # add 2 users in 3 groups each ADD + [ 'user', '%s2,%s3' % (uname, uname), '%s2,%s3,%s4' % (gname,gname,gname), '-v' ], GET + [ 'user', '%s2,%s3' % (uname, uname), '-l' ], # should add ONLY ONE user in a group and bypass empty one ADD + [ 'user', ',%s' % uname, ',%s2' % gname, '-v' ], # idem ADD + [ 'user', '%s,' % uname, '%s3,' % gname, '-v' ], GET + [ 'user', uname, '-l' ], # should delete only one user and bypass empty one DEL + [ 'user', ',%s' % uname, '-v'], # should fail (already deleted) DEL + [ 'user', '%s,' % uname, '-v'], # IDEM DEL + [ 'user', uname, '-v'], # delete 2 users at same time DEL + [ 'user', '%s2,%s3' % (uname, uname), '-v'], # delete groups, one, then two, then one (bypassing empty) DEL + [ 'group', gname, '-v'], DEL + [ 'group', '%s2,%s3' % (gname, gname), '-v'], DEL + [ 'group', ',%s4' % gname, '-v'], DEL + [ 'group', '%s4,' % gname, '-v'], DEL + [ 'group', '%s4' % gname, '-v'], ], descr='test short users/groups commands' ).Run() ScenarioTest([ ADD + [ 'group', gname, '-v' ], #should fail (the group is not a system group) ADD + [ 'privilege', gname, '-v' ], GET + [ 'privileges' ], ADD + [ 'group', '%ssys' % gname, '--system', '-v' ], ADD + [ 'privilege', '%ssys' % gname, '-v' ], GET + [ 'privileges' ], DEL + [ 'privilege', '%ssys' % gname ], GET + [ 'privileges' ], DEL + [ 'group', gname ], DEL + [ 'group', '%ssys' % gname ], ], descr='test short privileges commands' ).Run() ScenarioTest([ ADD + [ 'group', gname, '--system', '-v' ], ADD + [ 'group', '%s2' % gname, '-v' ], ADD + [ 'group', '%s3' % gname, '-v' ], # should fail (not a system group) ADD + [ 'profile', pname, '--group=%s2' % gname, '--force-existing' ], GET + [ 'profiles' ], # should be OK ADD + [ 'profile', pname, '--group=%s' % gname, '--force-existing' ], GET + [ 'profiles' ], MOD + [ 'profile', pname, '--add-groups=%s2,%s3' % (gname,gname) ], GET + [ 'profiles' ], MOD + [ 'profile', pname, '--del-groups=%s2,%s3' % (gname,gname) ], GET + [ 'profiles' ], DEL + [ 'profile', pname ], DEL + [ 'group', '%s2' % gname, '-v' ], DEL + [ 'group', '%s3' % gname, '-v' ], GET + [ 'profiles' ], ], descr='test short profiles commands' ).Run() ScenarioTest([ ADD + [ 'group', gname, '-v' ], ADD + [ 'group', '%s2' % gname, '-v' ], CHK + [ 'group', gname, '--auto-no', '-vv' ], CHK + [ 'group', gname, '--auto-yes', '-vv' ], CHK + [ 'group', gname, '-vb' ], CHK + [ 'group', '%s,%s2' % (gname,gname), '--auto-no', '-vv' ], CHK + [ 'group', '%s,%s2' % (gname,gname), '--auto-yes', '-vv' ], CHK + [ 'group', '%s,%s2' % (gname,gname), '-vb' ], DEL + [ 'group', '%s,%s2' % (gname,gname), '-v' ], CHK + [ 'config','--auto-no', '-vvae' ], CHK + [ 'config','--auto-yes', '-vvae' ], CHK + [ 'config','--batch', '-vvae' ], ADD + [ 'user', uname, '-v' ], CHK + [ 'user', uname, '--auto-no', '-v' ], CHK + [ 'user', uname, '--auto-yes', '-v' ], CHK + [ 'user', uname, '-vb' ], DEL + [ 'user', uname, '-v' ], ], descr='test short chk commands' ).Run() """ # extended check on user not implemented yet CHK + [ 'user', '%s,%s2' % (uname,uname), '--auto-no', '-vve' ], CHK + [ 'user', '%s,%s2' % (uname,uname), '--auto-yes', '-vve' ], CHK + [ 'user', '%s,%s2' % (uname,uname), '--batch', '-vve' ], DEL + [ 'user', '%s,%s2' % (uname,uname), '-v' ], # check on profile not implemented yet ADD + [ 'profile', '%s,%s2' % (pname,pname), '-v' ], CHK + [ 'profile', pname, '--auto-no', '-vve' ], CHK + [ 'profile', pname, '--auto-yes', '-vve' ], CHK + [ 'profile', pname, '--batch', '-vve' ], CHK + [ 'profile', '%s,%s2' % (pname,pname), '--auto-no', '-vve' ], CHK + [ 'profile', '%s,%s2' % (pname,pname), '--auto-yes', '-vve' ], CHK + [ 'profile', '%s,%s2' % (pname,pname), '--batch', '-vve' ], DEL + [ 'profile', '%s,%s2' % (pname,pname), '-v' ], """ | 38a496a61795ec7fb8b2f6589579ac75d0b90d9d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/38a496a61795ec7fb8b2f6589579ac75d0b90d9d/core.py |
'uidNumber' : int(entry[2]) , 'gidNumber' : int(entry[3]) , | 'uidNumber' : int(entry[2]) , 'gidNumber' : int(entry[3]) , | def load_users(self, groups = None): """ Load user accounts from /etc/{passwd,shadow} """ users = {} login_cache = {} | bfeeca2480af2d0423c5665ed6669d8084f9c6f1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/bfeeca2480af2d0423c5665ed6669d8084f9c6f1/unix_backend.py |
if entry[2] == "": users[uid]['shadowLastChange'] = 0 else: users[uid]['shadowLastChange'] = int(entry[2]) if entry[3] == "": users[uid]['shadowInactive'] = 99999 else: users[uid]['shadowInactive'] = int(entry[3]) if entry[4] == "": users[uid]['shadowWarning'] = entry[4] else: users[uid]['shadowWarning'] = int(entry[4]) if entry[5] == "": users[uid]['shadowExpire'] = entry[5] else: users[uid]['shadowExpire'] = int(entry[5]) | users[uid]['shadowLastChange'] = int(entry[2]) \ if entry[2] != '' else 0 users[uid]['shadowMin'] = int(entry[3]) \ if entry[3] != '' else 0 users[uid]['shadowMax'] = int(entry[4]) \ if entry[4] != '' else 99999 users[uid]['shadowWarning'] = int(entry[5]) \ if entry[5] != '' else 7 users[uid]['shadowInactive'] = int(entry[6]) \ if entry[6] != '' else '' users[uid]['shadowExpire'] = int(entry[7]) \ if entry[7] != '' else '' users[uid]['shadowFlag'] = int(entry[8]) \ if entry[8] != '' else '' | def load_users(self, groups = None): """ Load user accounts from /etc/{passwd,shadow} """ users = {} login_cache = {} | bfeeca2480af2d0423c5665ed6669d8084f9c6f1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/bfeeca2480af2d0423c5665ed6669d8084f9c6f1/unix_backend.py |
str(users[uid]['shadowWarning']), | def save_users(self): """ Write /etc/passwd and /etc/shadow """ | bfeeca2480af2d0423c5665ed6669d8084f9c6f1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/bfeeca2480af2d0423c5665ed6669d8084f9c6f1/unix_backend.py |
|
"","","" | str(users[uid]['shadowFlag']) | def save_users(self): """ Write /etc/passwd and /etc/shadow """ | bfeeca2480af2d0423c5665ed6669d8084f9c6f1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/bfeeca2480af2d0423c5665ed6669d8084f9c6f1/unix_backend.py |
['profile', '--group=utilisagers', '--del-users', '--no-archive'], ['profile', '--group=responsibilisateurs', '--del-users', '--no-archive'], ['profile', '--group=profil_test', '--del-users', | ['profile', '''--group=utilisagers,responsibilisateurs,''' '''profil_test''', '--del-users', | def clean_system(): """ Remove all stuff to make the system clean, testsuite-wise.""" test_message('''cleaning system from previous runs.''') # delete them first in case of a previous failed testsuite run. # don't check exit codes or such, this will be done later. for argument in ( ['user', '''toto,tutu,tata,titi,test,utilisager.normal,''' \ '''test.responsibilly,utilicateur.accentue,user_test,''' \ '''grp-acl-user,utest_267,user_test2,user_test3,user_testsys,''' \ '''user_testsys2,user_testsys3''', '--no-archive'], ['profile', '--group=utilisagers', '--del-users', '--no-archive'], ['profile', '--group=responsibilisateurs', '--del-users', '--no-archive'], ['profile', '--group=profil_test', '--del-users', '--no-archive'], ['group', '''test_users_A,test_users_B,groupeA,B-Group_Test,''' \ '''groupe_a_skel,ACL_tests,MOD_tests,SYSTEM-test,SKEL-tests,''' \ '''ARCHIVES-test,group_test,group_testsys,group_test2,group_test3,''' \ '''GRP-ACL-test,gtest_267,group_testsys'''], ['privilege', '--name=group_test' ], ): execute(DEL + argument) execute([ 'sudo', 'rm', '-rf', '%s/*' % configuration.home_backup_dir, '%s/*' % configuration.home_archive_dir ]) execute(ADD + ['group', '--system', 'acl,admins,remotessh,licorn-wmi']) test_message('''system cleaned from previous testsuite runs.''') | edbd6f39d6b3a15ba2568122985de331ccb47684 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/edbd6f39d6b3a15ba2568122985de331ccb47684/core.py |
'''ARCHIVES-test,group_test,group_testsys,group_test2,group_test3,''' \ '''GRP-ACL-test,gtest_267,group_testsys'''], ['privilege', '--name=group_test' ], ): | '''ARCHIVES-test,group_test,group_testsys,group_test2,''' '''group_test3,GRP-ACL-test,gtest_267,group_testsys''' ], ['privilege', '--name=group_test' ] ): | def clean_system(): """ Remove all stuff to make the system clean, testsuite-wise.""" test_message('''cleaning system from previous runs.''') # delete them first in case of a previous failed testsuite run. # don't check exit codes or such, this will be done later. for argument in ( ['user', '''toto,tutu,tata,titi,test,utilisager.normal,''' \ '''test.responsibilly,utilicateur.accentue,user_test,''' \ '''grp-acl-user,utest_267,user_test2,user_test3,user_testsys,''' \ '''user_testsys2,user_testsys3''', '--no-archive'], ['profile', '--group=utilisagers', '--del-users', '--no-archive'], ['profile', '--group=responsibilisateurs', '--del-users', '--no-archive'], ['profile', '--group=profil_test', '--del-users', '--no-archive'], ['group', '''test_users_A,test_users_B,groupeA,B-Group_Test,''' \ '''groupe_a_skel,ACL_tests,MOD_tests,SYSTEM-test,SKEL-tests,''' \ '''ARCHIVES-test,group_test,group_testsys,group_test2,group_test3,''' \ '''GRP-ACL-test,gtest_267,group_testsys'''], ['privilege', '--name=group_test' ], ): execute(DEL + argument) execute([ 'sudo', 'rm', '-rf', '%s/*' % configuration.home_backup_dir, '%s/*' % configuration.home_archive_dir ]) execute(ADD + ['group', '--system', 'acl,admins,remotessh,licorn-wmi']) test_message('''system cleaned from previous testsuite runs.''') | edbd6f39d6b3a15ba2568122985de331ccb47684 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/edbd6f39d6b3a15ba2568122985de331ccb47684/core.py |
'''the user list is up to date when the group is deleted.''' | ''' the user list is up to date when the group is deleted.''' | def chk_acls_cmds(group, subdir=None): return [ 'sudo', 'getfacl', '-R', '%s/%s/%s%s' % ( configuration.defaults.home_base_path, configuration.groups.names['plural'], group, '/%s' % subdir if subdir else '') ] | edbd6f39d6b3a15ba2568122985de331ccb47684 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/edbd6f39d6b3a15ba2568122985de331ccb47684/core.py |
DEL + [ 'group', gname ], | DEL + [ 'group', gname ] | def chk_acls_cmds(group, subdir=None): return [ 'sudo', 'getfacl', '-R', '%s/%s/%s%s' % ( configuration.defaults.home_base_path, configuration.groups.names['plural'], group, '/%s' % subdir if subdir else '') ] | edbd6f39d6b3a15ba2568122985de331ccb47684 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/edbd6f39d6b3a15ba2568122985de331ccb47684/core.py |
GET + [ 'privileges' ], ], context=context, descr='Check if privilege list is up to date after group deletion (fix | GET + [ 'privileges' ] ], context=context, descr='''Check if privilege list is up to date after group deletion''' ''' (fix | def chk_acls_cmds(group, subdir=None): return [ 'sudo', 'getfacl', '-R', '%s/%s/%s%s' % ( configuration.defaults.home_base_path, configuration.groups.names['plural'], group, '/%s' % subdir if subdir else '') ] | edbd6f39d6b3a15ba2568122985de331ccb47684 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/edbd6f39d6b3a15ba2568122985de331ccb47684/core.py |
GET + [ 'groups' ], | GET + [ 'groups' ] | def chk_acls_cmds(group, subdir=None): return [ 'sudo', 'getfacl', '-R', '%s/%s/%s%s' % ( configuration.defaults.home_base_path, configuration.groups.names['plural'], group, '/%s' % subdir if subdir else '') ] | edbd6f39d6b3a15ba2568122985de331ccb47684 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/edbd6f39d6b3a15ba2568122985de331ccb47684/core.py |
pname = 'profil_test' | def chk_acls_cmds(dir): return [ 'sudo', 'getfacl', '-R', dir ] | edbd6f39d6b3a15ba2568122985de331ccb47684 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/edbd6f39d6b3a15ba2568122985de331ccb47684/core.py |
|
AddUsersInGroup('users', [ u ]) | AddUsersInGroup('users', [ u ], batch = True) | def AddUsersInGroup(self, name, users_to_add, batch = False): """ Add a user list in the group 'name'. """ | 1bba8a79aeffdc50536b8e3cba83d9614529b69b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/1bba8a79aeffdc50536b8e3cba83d9614529b69b/groups.py |
<li><a href="http://dev.licorn.org/wiki/UserDoc/WMI" title="%s">%s</a></li> <li%s><a href="mailto:[email protected]?subject=[support] " title="%s">%s</a></li> | <li><a href="http://docs.licorn.org/userdoc.html" title="%s">%s</a></li> <li%s><a href="mailto:[email protected]?subject=[Support Licorn®] " title="%s">%s</a></li> | def __getitem__(self, key): try: return dict.__getitem__(self, key) except KeyError: return self.default | cb67effde95481b1baea8189247acf80e1f19ef1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/cb67effde95481b1baea8189247acf80e1f19ef1/utils.py |
_('Go to online documentation and community website (in new window or new tab).'), _('Documentation'), | _('Go to online documentation website.'), _('Documentation'), | def __getitem__(self, key): try: return dict.__getitem__(self, key) except KeyError: return self.default | cb67effde95481b1baea8189247acf80e1f19ef1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/cb67effde95481b1baea8189247acf80e1f19ef1/utils.py |
from licorn.system import keywords kw = keywords.KeywordsController(configuration) kw.DeleteKeyword(opts.name, opts.del_children) | from licorn.core import keywords keywords.DeleteKeyword(opts.name, opts.del_children) | def delete_keyword(): """ delete a system wide User profile. """ from licorn.system import keywords kw = keywords.KeywordsController(configuration) kw.DeleteKeyword(opts.name, opts.del_children) | 4640809bf9bcb3b9768a4f54189a08fa38e8d42d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/4640809bf9bcb3b9768a4f54189a08fa38e8d42d/del.py |
getpass.getpass(_('Please enter your LDAP password: ')), | getpass.getpass('Please enter your LDAP password: '), | def bind(self, need_write_access=True): """ Bind as admin or user, when LDAP needs a stronger authentication.""" ltrace('ldap','binding as %s.' % ( styles.stylize(styles.ST_LOGIN, self.bind_dn))) | 3ee86d806c091979bdb92e3a155d27b5c483d482 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/3ee86d806c091979bdb92e3a155d27b5c483d482/ldap_backend.py |
os.path.dirname(__file__),input_name), 'r')) | '/usr/share/licorn', input_name), 'r')) | def __init__(self, input_name): LDIFParser.__init__(self, open('%s/schemas/%s.ldif' % ( os.path.dirname(__file__),input_name), 'r')) | 161817230b449e4ae5c4ec11f8be32451db29be3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/161817230b449e4ae5c4ec11f8be32451db29be3/ldaputils.py |
logging.progress('%s: saving data structures to disk.' % \ self.pretty_name) lock_file = file_locks.FileLock(self.configuration, self.configuration.keywords_data_file) lock_file.Lock() open(self.configuration.keywords_data_file , "w").write(self.__build_cli_output()) lock_file.Unlock() | if self.changed : logging.progress('%s: saving data structures to disk.' % \ self.pretty_name) lock_file = file_locks.FileLock(self.configuration, self.configuration.keywords_data_file) lock_file.Lock() open(self.configuration.keywords_data_file , "w").write(self.__build_cli_output()) lock_file.Unlock() logging.progress('%s: data structures saved.' % \ self.pretty_name) self.changed = False | def WriteConf(self): """ Write the keywords data in appropriate system files.""" logging.progress('%s: saving data structures to disk.' % \ self.pretty_name) | 79be33ad35e5abf9b9e98709a8fa8bad16c9097b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/79be33ad35e5abf9b9e98709a8fa8bad16c9097b/keywords.py |
from licorn import system as hzsys | def AddKeyword(self, name = None, parent = "", description = ""): """ Add a new keyword on the system, provided some checks are OK. """ if name is None: raise exceptions.BadArgumentError(logging.SYSK_SPECIFY_KEYWORD) | 79be33ad35e5abf9b9e98709a8fa8bad16c9097b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/79be33ad35e5abf9b9e98709a8fa8bad16c9097b/keywords.py |
|
""" | """ Delete a keyword | def DeleteKeyword(self, name=None, del_children=False, modify_file=True): """ """ if name is None: raise exceptions.BadArgumentError(logging.SYSK_SPECIFY_KEYWORD) | 79be33ad35e5abf9b9e98709a8fa8bad16c9097b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/79be33ad35e5abf9b9e98709a8fa8bad16c9097b/keywords.py |
self.WriteConf() | self.changed = True | def DeleteKeyword(self, name=None, del_children=False, modify_file=True): """ """ if name is None: raise exceptions.BadArgumentError(logging.SYSK_SPECIFY_KEYWORD) | 79be33ad35e5abf9b9e98709a8fa8bad16c9097b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/79be33ad35e5abf9b9e98709a8fa8bad16c9097b/keywords.py |
self.WriteConf() | self.changed = True | def ChangeParent(self, name, parent): """ Change keyword's parent """ try: self.keywords[parent] self.keywords[name]["parent"] = parent except KeyError, e: raise exceptions.BadArgumentError("The keyword %s doesn't exist on this system." % str(e)) self.WriteConf() | 79be33ad35e5abf9b9e98709a8fa8bad16c9097b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/79be33ad35e5abf9b9e98709a8fa8bad16c9097b/keywords.py |
self.WriteConf() | self.changed = True | def RemoveParent(self, name): """ Remove parent of the keyword 'name' """ try: self.keywords[name]["parent"] = "" except KeyError, e: raise exceptions.BadArgumentError("The keyword you specified doesn't exist on this system.") self.WriteConf() | 79be33ad35e5abf9b9e98709a8fa8bad16c9097b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/79be33ad35e5abf9b9e98709a8fa8bad16c9097b/keywords.py |
self.WriteConf() | self.changed = True | def ChangeDescription(self, name, description): """ Change the description of a keyword """ try: self.keywords[name]["description"] = description except KeyError, e: raise exceptions.BadArgumentError("The keyword you specified doesn't exist on this system.") self.WriteConf() | 79be33ad35e5abf9b9e98709a8fa8bad16c9097b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/79be33ad35e5abf9b9e98709a8fa8bad16c9097b/keywords.py |
if opts.groups_to_del: something_done = True for g in opts.groups_to_del.split(','): if g != '': try: LMC.groups.DeleteUsersFromGroup(name=g, users_to_del=[ uid ]) except exceptions.LicornRuntimeException, e: logging.warning('''Unable to remove user %s from ''' '''group %s (was: %s).''' % ( stylize(ST_LOGIN, opts.login), stylize(ST_NAME, g), str(e))) except exceptions.LicornException, e: raise exceptions.LicornRuntimeError( '''Unable to remove user %s from ''' '''group %s (was: %s).''' % ( stylize(ST_LOGIN, opts.login), stylize(ST_NAME, g), str(e))) | def mod_user(self, opts, args): """ Modify a POSIX user account (Samba / LDAP included). """ | 90fbd6b382ab2eb19d02464f671b2b17e8edc763 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/90fbd6b382ab2eb19d02464f671b2b17e8edc763/rwi.py |
|
users.Select(filters.STANDARD) dest = group['memberUid'] source = [ u[uid]['login'] for uid in users.filtered_users ] for current in group['memberUid']: | dest = groups[groups.name_to_gid(gname)]['memberUid'][:] source = [ u[uid]['login'] \ for uid in users.Select(filters.STANDARD) ] for current in dest[:]: | def edit(uri, http_user, name): """Edit a group.""" users.reload() groups.reload() u = users.users g = groups.groups title = _("Editing group %s") % name if protected_group(name, complete=False): return w.forgery_error(title) data = w.page_body_start(uri, http_user, ctxtnav, title, False) try: group = g[groups.name_to_gid(name)] sys = groups.is_system_group(name) dbl_lists = {} if sys: groups_filters_lists_ids = [ (name, [ _('Manage members'), _('Users not yet members'), _('Current members') ], 'members' ) ] # , # (configuration.groups.resp_prefix + name, None, ' ' ), # (configuration.groups.guest_prefix + name, None, ' ' ) else: groups_filters_lists_ids = ( (name, [_('Manage members'), _('Users not yet members'), _('Current members')], 'members'), (configuration.groups.resp_prefix + name, [_('Manage responsibles'), _('Users not yet responsibles'), _('Current responsibles')], 'resps'), (configuration.groups.guest_prefix + name, [_('Manage guests'), _('Users not yet guests'), _('Current guests')], 'guests') ) for (gname, titles, id) in groups_filters_lists_ids: if titles is None: dbl_lists[gname] = id else: users.Select(filters.STANDARD) dest = group['memberUid'] source = [ u[uid]['login'] for uid in users.filtered_users ] for current in group['memberUid']: try: source.remove(current) except ValueError: dest.remove(current) dest.sort() source.sort() dbl_lists[gname] = w.doubleListBox(titles, id, source, dest) def descr(desc, system): return w.input('description', desc, size=30, maxlength=256, accesskey='D') def skel(cur_skel, system): return '' if system else \ ''' <tr> <td><strong>%s</strong></td> <td class="right">%s</td> </tr> ''' % (_('Skeleton'), w.select('skel', configuration.users.skels, cur_skel, func = os.path.basename)) def permissive(perm, system): return '' if system else \ ''' <tr> <td><strong>%s</strong></td> <td class="right">%s</td> </tr> ''' % (_('Permissive shared dir?'), w.checkbox('permissive', "True", "Oui", checked = perm )) form_name = "group_edit_form" if sys: data_rsp_gst ='' else : data_rsp_gst = ''' | 795d658df5a926e8654848cc1ef896dc0198a536 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/795d658df5a926e8654848cc1ef896dc0198a536/groups.py |
def refork_as_root_or_die(process_title='licorn-generic', prefunc=None): | def refork_as_root_or_die(process_title='licorn-generic', prefunc=None, group='admins'): | def refork_as_root_or_die(process_title='licorn-generic', prefunc=None): """ check if current user is root. if not, check if he/she is member of group "admins" and then refork ourselves with sudo, to gain root privileges, needed for Licorn® daemon. Do it with traditionnal syscalls, because the rest of Licorn® is not initialized if we run this function. """ group = 'admins' if pwd.getpwuid(os.getuid()).pw_name in grp.getgrnam(group).gr_mem: cmd=[ process_title ] cmd.extend(sys.argv) if prefunc != None: prefunc() logging.progress('''Exec'ing ourselves with sudo to gain root ''' '''privileges (execvp(%s)).''' % cmd) os.execvp('sudo', cmd) else: raise exceptions.LicornRuntimeError('''You're not a member of group ''' '''%s, can't do anything for you, sorry!''' % group) | bb6e00d9cb5dc0407c65b72d619769244f5faa93 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/bb6e00d9cb5dc0407c65b72d619769244f5faa93/process.py |
group = 'admins' if pwd.getpwuid(os.getuid()).pw_name in grp.getgrnam(group).gr_mem: | try: gmembers = grp.getgrnam(group).gr_mem except KeyError: logging.error('''group %s doesn't exist and we are not root, ''' '''aborting. Please manually relaunch this program with root ''' '''privileges for the group to be created.''' % group) if pwd.getpwuid(os.getuid()).pw_name in gmembers: | def refork_as_root_or_die(process_title='licorn-generic', prefunc=None): """ check if current user is root. if not, check if he/she is member of group "admins" and then refork ourselves with sudo, to gain root privileges, needed for Licorn® daemon. Do it with traditionnal syscalls, because the rest of Licorn® is not initialized if we run this function. """ group = 'admins' if pwd.getpwuid(os.getuid()).pw_name in grp.getgrnam(group).gr_mem: cmd=[ process_title ] cmd.extend(sys.argv) if prefunc != None: prefunc() logging.progress('''Exec'ing ourselves with sudo to gain root ''' '''privileges (execvp(%s)).''' % cmd) os.execvp('sudo', cmd) else: raise exceptions.LicornRuntimeError('''You're not a member of group ''' '''%s, can't do anything for you, sorry!''' % group) | bb6e00d9cb5dc0407c65b72d619769244f5faa93 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/bb6e00d9cb5dc0407c65b72d619769244f5faa93/process.py |
self.users.users[uid]['groups'].sort() | LMC.users[uid]['groups'].sort() | def AddUsersInGroup(self, name=None, gid=None, users_to_add=None, batch=False, listener=None): """ Add a user list in the group 'name'. """ | cbb9c398d85518e2e4cc58ae73f59972bea8a965 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/cbb9c398d85518e2e4cc58ae73f59972bea8a965/groups.py |
description = 'Les membres du groupe "%s"' % name | description = 'Les membres du groupe “%s”' % name | def AddGroup(self, name, gid=None, description="", skel="", system=False, permissive=False, batch=False): """ Add an Licorn group (the group + the responsible group + the shared dir + permissions). """ | 5df7019e82c42ca6e488a51473408342f8fa287e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/5df7019e82c42ca6e488a51473408342f8fa287e/groups.py |
raise exceptions.BadArgumentError("Malformed group name `%s', must match /%s/i." | raise exceptions.BadArgumentError("Malformed group name '%s', must match /%s/i." | def AddGroup(self, name, gid=None, description="", skel="", system=False, permissive=False, batch=False): """ Add an Licorn group (the group + the responsible group + the shared dir + permissions). """ | 5df7019e82c42ca6e488a51473408342f8fa287e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/5df7019e82c42ca6e488a51473408342f8fa287e/groups.py |
('gecos', str), | ('gecos', decodestring), | def account_lock(value, tmp_entry=temp_user_dict): try: # get around an error where password is not base64 encoded. password = decodestring(value.split('}',1)[1]) except Exception: password = value | 70f55aa75513acf52d23d3d0608517a1a47d30b5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/70f55aa75513acf52d23d3d0608517a1a47d30b5/ldap_backend.py |
user['cn'] = login | def save_user(self, uid): """ Save one user in the LDAP backend. If updating, the entry will be dropped prior of insertion. """ | 70f55aa75513acf52d23d3d0608517a1a47d30b5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/70f55aa75513acf52d23d3d0608517a1a47d30b5/ldap_backend.py |
|
onClick = 'onClick="javascript: return(false);"' | onClick = 'onClick="javascript: return(false);"' | def ctxtnav(active = True): if active: disabled = ''; onClick = ''; else: disabled = 'un-clickable'; onClick = 'onClick="javascript: return(false);"' return ''' <div id="ctxtnav" class="nav"> <h2>Context Navigation</h2> <ul> <li><a href="/groups/new" title="%s" %s class="%s"><div class="ctxt-icon %s" id="icon-add">%s</div></a></li> </ul> </div> ''' % (_('Add a new group on the system.'), onClick, disabled, disabled, _('Add a group')) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
data = '%s\n%s\n%s' % (w.backto(), __groups_actions(), w.menu(uri)) | data = w.page_body_start(uri, http_user, ctxtnav, title, False) | def unlock(uri, http_user, name, sure = False): """ Make a shared group dir permissive. """ title = _("Make group %s permissive") % name data = '%s\n%s\n%s' % (w.backto(), __groups_actions(), w.menu(uri)) if not sure: description = _('''This will permit large access to files and folders in the group shared dir, and will allow any member of the group to modify / delete any document, even if he/she is not owner of the document. This option can be dangerous, but if group members are accustomed to work together, there is no problem. Generally speaking you will use this feature on small working groups. <br /> Warning: <strong> The operation may be lengthy because the system will change permissions of all current data </ strong> (duration is therefore depending on the volume of data, about 1 second for 100Mio).''') data += w.question(_("Are you sure you want to active permissiveness on group <strong>%s</strong>?") % name, description, yes_values = [ _("Activate") + ' >>', "/groups/unlock/%s/sure" % name, _("A") ], no_values = [ '<< ' + _("Cancel"), "/groups/list", _("N") ]) return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "group", "--quiet", "--no-colors", "--name", name, "--set-permissive" ] return w.page(title, data + w.run(command, uri, successfull_redirect = "/groups/list", err_msg = _("Failed to activate permissivenes on group <strong>%s</strong>!") % name)) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
document. This option can be dangerous, but if group members are | document. This option can be dangerous, but if group members are | def unlock(uri, http_user, name, sure = False): """ Make a shared group dir permissive. """ title = _("Make group %s permissive") % name data = '%s\n%s\n%s' % (w.backto(), __groups_actions(), w.menu(uri)) if not sure: description = _('''This will permit large access to files and folders in the group shared dir, and will allow any member of the group to modify / delete any document, even if he/she is not owner of the document. This option can be dangerous, but if group members are accustomed to work together, there is no problem. Generally speaking you will use this feature on small working groups. <br /> Warning: <strong> The operation may be lengthy because the system will change permissions of all current data </ strong> (duration is therefore depending on the volume of data, about 1 second for 100Mio).''') data += w.question(_("Are you sure you want to active permissiveness on group <strong>%s</strong>?") % name, description, yes_values = [ _("Activate") + ' >>', "/groups/unlock/%s/sure" % name, _("A") ], no_values = [ '<< ' + _("Cancel"), "/groups/list", _("N") ]) return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "group", "--quiet", "--no-colors", "--name", name, "--set-permissive" ] return w.page(title, data + w.run(command, uri, successfull_redirect = "/groups/list", err_msg = _("Failed to activate permissivenes on group <strong>%s</strong>!") % name)) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
you will use this feature on small working groups. <br /> Warning: | you will use this feature on small working groups. <br /> Warning: | def unlock(uri, http_user, name, sure = False): """ Make a shared group dir permissive. """ title = _("Make group %s permissive") % name data = '%s\n%s\n%s' % (w.backto(), __groups_actions(), w.menu(uri)) if not sure: description = _('''This will permit large access to files and folders in the group shared dir, and will allow any member of the group to modify / delete any document, even if he/she is not owner of the document. This option can be dangerous, but if group members are accustomed to work together, there is no problem. Generally speaking you will use this feature on small working groups. <br /> Warning: <strong> The operation may be lengthy because the system will change permissions of all current data </ strong> (duration is therefore depending on the volume of data, about 1 second for 100Mio).''') data += w.question(_("Are you sure you want to active permissiveness on group <strong>%s</strong>?") % name, description, yes_values = [ _("Activate") + ' >>', "/groups/unlock/%s/sure" % name, _("A") ], no_values = [ '<< ' + _("Cancel"), "/groups/list", _("N") ]) return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "group", "--quiet", "--no-colors", "--name", name, "--set-permissive" ] return w.page(title, data + w.run(command, uri, successfull_redirect = "/groups/list", err_msg = _("Failed to activate permissivenes on group <strong>%s</strong>!") % name)) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
permissions of all current data </ strong> (duration is therefore | permissions of all current data </ strong> (duration is therefore | def unlock(uri, http_user, name, sure = False): """ Make a shared group dir permissive. """ title = _("Make group %s permissive") % name data = '%s\n%s\n%s' % (w.backto(), __groups_actions(), w.menu(uri)) if not sure: description = _('''This will permit large access to files and folders in the group shared dir, and will allow any member of the group to modify / delete any document, even if he/she is not owner of the document. This option can be dangerous, but if group members are accustomed to work together, there is no problem. Generally speaking you will use this feature on small working groups. <br /> Warning: <strong> The operation may be lengthy because the system will change permissions of all current data </ strong> (duration is therefore depending on the volume of data, about 1 second for 100Mio).''') data += w.question(_("Are you sure you want to active permissiveness on group <strong>%s</strong>?") % name, description, yes_values = [ _("Activate") + ' >>', "/groups/unlock/%s/sure" % name, _("A") ], no_values = [ '<< ' + _("Cancel"), "/groups/list", _("N") ]) return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "group", "--quiet", "--no-colors", "--name", name, "--set-permissive" ] return w.page(title, data + w.run(command, uri, successfull_redirect = "/groups/list", err_msg = _("Failed to activate permissivenes on group <strong>%s</strong>!") % name)) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
def unlock(uri, http_user, name, sure = False): """ Make a shared group dir permissive. """ title = _("Make group %s permissive") % name data = '%s\n%s\n%s' % (w.backto(), __groups_actions(), w.menu(uri)) if not sure: description = _('''This will permit large access to files and folders in the group shared dir, and will allow any member of the group to modify / delete any document, even if he/she is not owner of the document. This option can be dangerous, but if group members are accustomed to work together, there is no problem. Generally speaking you will use this feature on small working groups. <br /> Warning: <strong> The operation may be lengthy because the system will change permissions of all current data </ strong> (duration is therefore depending on the volume of data, about 1 second for 100Mio).''') data += w.question(_("Are you sure you want to active permissiveness on group <strong>%s</strong>?") % name, description, yes_values = [ _("Activate") + ' >>', "/groups/unlock/%s/sure" % name, _("A") ], no_values = [ '<< ' + _("Cancel"), "/groups/list", _("N") ]) return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "group", "--quiet", "--no-colors", "--name", name, "--set-permissive" ] return w.page(title, data + w.run(command, uri, successfull_redirect = "/groups/list", err_msg = _("Failed to activate permissivenes on group <strong>%s</strong>!") % name)) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
def unlock(uri, http_user, name, sure = False): """ Make a shared group dir permissive. """ title = _("Make group %s permissive") % name data = '%s\n%s\n%s' % (w.backto(), __groups_actions(), w.menu(uri)) if not sure: description = _('''This will permit large access to files and folders in the group shared dir, and will allow any member of the group to modify / delete any document, even if he/she is not owner of the document. This option can be dangerous, but if group members are accustomed to work together, there is no problem. Generally speaking you will use this feature on small working groups. <br /> Warning: <strong> The operation may be lengthy because the system will change permissions of all current data </ strong> (duration is therefore depending on the volume of data, about 1 second for 100Mio).''') data += w.question(_("Are you sure you want to active permissiveness on group <strong>%s</strong>?") % name, description, yes_values = [ _("Activate") + ' >>', "/groups/unlock/%s/sure" % name, _("A") ], no_values = [ '<< ' + _("Cancel"), "/groups/list", _("N") ]) return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "group", "--quiet", "--no-colors", "--name", name, "--set-permissive" ] return w.page(title, data + w.run(command, uri, successfull_redirect = "/groups/list", err_msg = _("Failed to activate permissivenes on group <strong>%s</strong>!") % name)) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
data = '%s\n%s\n%s\n' % (w.backto(), __groups_actions(), w.menu(uri)) | data = w.page_body_start(uri, http_user, ctxtnav, title, False) | def lock(uri, http_user, name, sure = False): """ Make a group not permissive. """ title = _("Make group %s not permissive") % name data = '%s\n%s\n%s\n' % (w.backto(), __groups_actions(), w.menu(uri)) if not sure: description = _('''This will ensure finer write access to files and folders in the group shared dir. Only the owner / creator of a document will be able to modify it; other group members will only be able to read such a document (unless the owner manually assign other permissions, which are not guaranteed to be maintained by the system). <br /> Warning: <strong> The operation may be lengthy because the system will switch permissions of all current group shared data</strong> (duration is therefore depending on the volume of data, about 1 second for 100Mio).''') data += w.question(_("Are you sure you want to make group <strong>%s</strong> not permissive?") % name, description, yes_values = [ _("Deactivate") + ' >>', "/groups/lock/%s/sure" % name, _("D") ], no_values = [ '<< ' + _("Cancel"), "/groups/list", _("N") ]) return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "group", "--quiet", "--no-colors", "--name", name, "--set-not-permissive" ] return w.page(title, data + w.run(command, uri, successfull_redirect = "/groups/list", err_msg = _("Failed to remove permissiveness from group <strong>%s</strong>!") % name)) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
data</strong> (duration is therefore depending on the volume of data, about 1 | data</strong> (duration is therefore depending on the volume of data, about 1 | def lock(uri, http_user, name, sure = False): """ Make a group not permissive. """ title = _("Make group %s not permissive") % name data = '%s\n%s\n%s\n' % (w.backto(), __groups_actions(), w.menu(uri)) if not sure: description = _('''This will ensure finer write access to files and folders in the group shared dir. Only the owner / creator of a document will be able to modify it; other group members will only be able to read such a document (unless the owner manually assign other permissions, which are not guaranteed to be maintained by the system). <br /> Warning: <strong> The operation may be lengthy because the system will switch permissions of all current group shared data</strong> (duration is therefore depending on the volume of data, about 1 second for 100Mio).''') data += w.question(_("Are you sure you want to make group <strong>%s</strong> not permissive?") % name, description, yes_values = [ _("Deactivate") + ' >>', "/groups/lock/%s/sure" % name, _("D") ], no_values = [ '<< ' + _("Cancel"), "/groups/list", _("N") ]) return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "group", "--quiet", "--no-colors", "--name", name, "--set-not-permissive" ] return w.page(title, data + w.run(command, uri, successfull_redirect = "/groups/list", err_msg = _("Failed to remove permissiveness from group <strong>%s</strong>!") % name)) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
def lock(uri, http_user, name, sure = False): """ Make a group not permissive. """ title = _("Make group %s not permissive") % name data = '%s\n%s\n%s\n' % (w.backto(), __groups_actions(), w.menu(uri)) if not sure: description = _('''This will ensure finer write access to files and folders in the group shared dir. Only the owner / creator of a document will be able to modify it; other group members will only be able to read such a document (unless the owner manually assign other permissions, which are not guaranteed to be maintained by the system). <br /> Warning: <strong> The operation may be lengthy because the system will switch permissions of all current group shared data</strong> (duration is therefore depending on the volume of data, about 1 second for 100Mio).''') data += w.question(_("Are you sure you want to make group <strong>%s</strong> not permissive?") % name, description, yes_values = [ _("Deactivate") + ' >>', "/groups/lock/%s/sure" % name, _("D") ], no_values = [ '<< ' + _("Cancel"), "/groups/list", _("N") ]) return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "group", "--quiet", "--no-colors", "--name", name, "--set-not-permissive" ] return w.page(title, data + w.run(command, uri, successfull_redirect = "/groups/list", err_msg = _("Failed to remove permissiveness from group <strong>%s</strong>!") % name)) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
def lock(uri, http_user, name, sure = False): """ Make a group not permissive. """ title = _("Make group %s not permissive") % name data = '%s\n%s\n%s\n' % (w.backto(), __groups_actions(), w.menu(uri)) if not sure: description = _('''This will ensure finer write access to files and folders in the group shared dir. Only the owner / creator of a document will be able to modify it; other group members will only be able to read such a document (unless the owner manually assign other permissions, which are not guaranteed to be maintained by the system). <br /> Warning: <strong> The operation may be lengthy because the system will switch permissions of all current group shared data</strong> (duration is therefore depending on the volume of data, about 1 second for 100Mio).''') data += w.question(_("Are you sure you want to make group <strong>%s</strong> not permissive?") % name, description, yes_values = [ _("Deactivate") + ' >>', "/groups/lock/%s/sure" % name, _("D") ], no_values = [ '<< ' + _("Cancel"), "/groups/list", _("N") ]) return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "group", "--quiet", "--no-colors", "--name", name, "--set-not-permissive" ] return w.page(title, data + w.run(command, uri, successfull_redirect = "/groups/list", err_msg = _("Failed to remove permissiveness from group <strong>%s</strong>!") % name)) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
data = '%s\n%s\n%s\n' % (w.backto(), __groups_actions(), w.menu(uri)) | data = w.page_body_start(uri, http_user, ctxtnav, title, False) | def delete(uri, http_user, name, sure = False, no_archive = False, yes = None): """ Remove group and archive (or not) group shared dir. """ del yes title = _("Remove group %s") % name data = '%s\n%s\n%s\n' % (w.backto(), __groups_actions(), w.menu(uri)) groups.reload() if groups.is_system_group(name): return w.page(title, w.error(_("Failed to remove group"), [ _("alter system group.") ], _("insufficient permissions to perform operation."))) if not sure: data += w.question(_("Are you sure you want to remove group <strong>%s</strong>?") % name, _("""Group shared data will be archived in directory %s, and accessible to members of group %s for eventual recovery. However, you can decideto remove them permanently.""") % (configuration.home_archive_dir, configuration.defaults.admin_group), yes_values = [ _("Remove") + ' >>', "/groups/delete/%s/sure" % name, _("R") ], no_values = [ '<< ' + _("Cancel"), "/groups/list", _("N") ], form_options = w.checkbox("no_archive", "True", _("Definitely remove group shared data."), checked = False) ) return w.page(title, data) else: # we are sure, do it ! command = [ 'sudo', 'del', 'group', '--quiet', '--no-colors', '--name', name ] if no_archive: command.extend(['--no-archive']) return w.page(title, data + w.run(command, uri, successfull_redirect = "/groups/list", err_msg = _("Failed to remove group <strong>%s</strong>!") % name)) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
return w.page(title, w.error(_("Failed to remove group"), | return w.page(title, w.error(_("Failed to remove group"), | def delete(uri, http_user, name, sure = False, no_archive = False, yes = None): """ Remove group and archive (or not) group shared dir. """ del yes title = _("Remove group %s") % name data = '%s\n%s\n%s\n' % (w.backto(), __groups_actions(), w.menu(uri)) groups.reload() if groups.is_system_group(name): return w.page(title, w.error(_("Failed to remove group"), [ _("alter system group.") ], _("insufficient permissions to perform operation."))) if not sure: data += w.question(_("Are you sure you want to remove group <strong>%s</strong>?") % name, _("""Group shared data will be archived in directory %s, and accessible to members of group %s for eventual recovery. However, you can decideto remove them permanently.""") % (configuration.home_archive_dir, configuration.defaults.admin_group), yes_values = [ _("Remove") + ' >>', "/groups/delete/%s/sure" % name, _("R") ], no_values = [ '<< ' + _("Cancel"), "/groups/list", _("N") ], form_options = w.checkbox("no_archive", "True", _("Definitely remove group shared data."), checked = False) ) return w.page(title, data) else: # we are sure, do it ! command = [ 'sudo', 'del', 'group', '--quiet', '--no-colors', '--name', name ] if no_archive: command.extend(['--no-archive']) return w.page(title, data + w.run(command, uri, successfull_redirect = "/groups/list", err_msg = _("Failed to remove group <strong>%s</strong>!") % name)) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
and accessible to members of group %s for eventual recovery. However, you can decideto remove them | and accessible to members of group %s for eventual recovery. However, you can decideto remove them | def delete(uri, http_user, name, sure = False, no_archive = False, yes = None): """ Remove group and archive (or not) group shared dir. """ del yes title = _("Remove group %s") % name data = '%s\n%s\n%s\n' % (w.backto(), __groups_actions(), w.menu(uri)) groups.reload() if groups.is_system_group(name): return w.page(title, w.error(_("Failed to remove group"), [ _("alter system group.") ], _("insufficient permissions to perform operation."))) if not sure: data += w.question(_("Are you sure you want to remove group <strong>%s</strong>?") % name, _("""Group shared data will be archived in directory %s, and accessible to members of group %s for eventual recovery. However, you can decideto remove them permanently.""") % (configuration.home_archive_dir, configuration.defaults.admin_group), yes_values = [ _("Remove") + ' >>', "/groups/delete/%s/sure" % name, _("R") ], no_values = [ '<< ' + _("Cancel"), "/groups/list", _("N") ], form_options = w.checkbox("no_archive", "True", _("Definitely remove group shared data."), checked = False) ) return w.page(title, data) else: # we are sure, do it ! command = [ 'sudo', 'del', 'group', '--quiet', '--no-colors', '--name', name ] if no_archive: command.extend(['--no-archive']) return w.page(title, data + w.run(command, uri, successfull_redirect = "/groups/list", err_msg = _("Failed to remove group <strong>%s</strong>!") % name)) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
form_options = w.checkbox("no_archive", "True", | form_options = w.checkbox("no_archive", "True", | def delete(uri, http_user, name, sure = False, no_archive = False, yes = None): """ Remove group and archive (or not) group shared dir. """ del yes title = _("Remove group %s") % name data = '%s\n%s\n%s\n' % (w.backto(), __groups_actions(), w.menu(uri)) groups.reload() if groups.is_system_group(name): return w.page(title, w.error(_("Failed to remove group"), [ _("alter system group.") ], _("insufficient permissions to perform operation."))) if not sure: data += w.question(_("Are you sure you want to remove group <strong>%s</strong>?") % name, _("""Group shared data will be archived in directory %s, and accessible to members of group %s for eventual recovery. However, you can decideto remove them permanently.""") % (configuration.home_archive_dir, configuration.defaults.admin_group), yes_values = [ _("Remove") + ' >>', "/groups/delete/%s/sure" % name, _("R") ], no_values = [ '<< ' + _("Cancel"), "/groups/list", _("N") ], form_options = w.checkbox("no_archive", "True", _("Definitely remove group shared data."), checked = False) ) return w.page(title, data) else: # we are sure, do it ! command = [ 'sudo', 'del', 'group', '--quiet', '--no-colors', '--name', name ] if no_archive: command.extend(['--no-archive']) return w.page(title, data + w.run(command, uri, successfull_redirect = "/groups/list", err_msg = _("Failed to remove group <strong>%s</strong>!") % name)) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
return w.page(title, data + | return w.page(title, data + | def delete(uri, http_user, name, sure = False, no_archive = False, yes = None): """ Remove group and archive (or not) group shared dir. """ del yes title = _("Remove group %s") % name data = '%s\n%s\n%s\n' % (w.backto(), __groups_actions(), w.menu(uri)) groups.reload() if groups.is_system_group(name): return w.page(title, w.error(_("Failed to remove group"), [ _("alter system group.") ], _("insufficient permissions to perform operation."))) if not sure: data += w.question(_("Are you sure you want to remove group <strong>%s</strong>?") % name, _("""Group shared data will be archived in directory %s, and accessible to members of group %s for eventual recovery. However, you can decideto remove them permanently.""") % (configuration.home_archive_dir, configuration.defaults.admin_group), yes_values = [ _("Remove") + ' >>', "/groups/delete/%s/sure" % name, _("R") ], no_values = [ '<< ' + _("Cancel"), "/groups/list", _("N") ], form_options = w.checkbox("no_archive", "True", _("Definitely remove group shared data."), checked = False) ) return w.page(title, data) else: # we are sure, do it ! command = [ 'sudo', 'del', 'group', '--quiet', '--no-colors', '--name', name ] if no_archive: command.extend(['--no-archive']) return w.page(title, data + w.run(command, uri, successfull_redirect = "/groups/list", err_msg = _("Failed to remove group <strong>%s</strong>!") % name)) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
def delete(uri, http_user, name, sure = False, no_archive = False, yes = None): """ Remove group and archive (or not) group shared dir. """ del yes title = _("Remove group %s") % name data = '%s\n%s\n%s\n' % (w.backto(), __groups_actions(), w.menu(uri)) groups.reload() if groups.is_system_group(name): return w.page(title, w.error(_("Failed to remove group"), [ _("alter system group.") ], _("insufficient permissions to perform operation."))) if not sure: data += w.question(_("Are you sure you want to remove group <strong>%s</strong>?") % name, _("""Group shared data will be archived in directory %s, and accessible to members of group %s for eventual recovery. However, you can decideto remove them permanently.""") % (configuration.home_archive_dir, configuration.defaults.admin_group), yes_values = [ _("Remove") + ' >>', "/groups/delete/%s/sure" % name, _("R") ], no_values = [ '<< ' + _("Cancel"), "/groups/list", _("N") ], form_options = w.checkbox("no_archive", "True", _("Definitely remove group shared data."), checked = False) ) return w.page(title, data) else: # we are sure, do it ! command = [ 'sudo', 'del', 'group', '--quiet', '--no-colors', '--name', name ] if no_archive: command.extend(['--no-archive']) return w.page(title, data + w.run(command, uri, successfull_redirect = "/groups/list", err_msg = _("Failed to remove group <strong>%s</strong>!") % name)) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
data = '%s%s' % (w.backto(), __groups_actions(title)) | data = w.page_body_start(uri, http_user, ctxtnav, title, False) | def skel(req, name, sure = False, apply_skel = configuration.users.default_skel): """ TO BE IMPLEMENTED ! reapply a user's skel with confirmation.""" users.reload() profiles.reload() groups.reload() title = _("Skeleton reapplying for group %s") % name data = '%s%s' % (w.backto(), __groups_actions(title)) if not sure: allusers = u.UsersList(configuration) allgroups = g.GroupsList(configuration, allusers) description = _('''This will reset the desktops, icons and menus of all members of the group, according to the content of the skel you choose. This will NOT alter any of the user personnal data, nor the group shared data.''') pri_group = allgroups.groups[allusers.users[users.UsersList.login_to_uid(login)]['gid']]['name'] # liste des skels du profile en cours. def filter_skels(pri_group, sk_list): ''' TODO: to be converted to licorn model if pri_group == configuration.mNames['RESPONSABLES_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['RESPONSABLES_GROUP']) != -1, sk_list) elif pri_group == configuration.mNames['USAGERS_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['USAGERS_GROUP']) != -1, sk_list) else: ''' return sk_list form_options = _("Which skel do you wish to reapply to members of this group? %s") \ % w.select("apply_skel", filter_skels(pri_group, configuration.users.skels), func = os.path.basename) data += w.question( _("Are you sure you want to reapply this skel to all of the members of %s?") % login, description, yes_values = [ _("Apply") + ' >>', "/users/skel/%s/sure" % login, _("A") ], no_values = [ '<< ' + _("Cancel"), "/groups/list", _("N") ], form_options = form_options) return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, '--apply-skel', skel ] return w.page(title, data + w.run(command, req, successfull_redirect = "/groups/list", err_msg = _("Failed to apply skel %s to members of group %s.") % (os.path.basename(apply_skel), login))) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
of all members of the group, according to the content of the | of all members of the group, according to the content of the | def skel(req, name, sure = False, apply_skel = configuration.users.default_skel): """ TO BE IMPLEMENTED ! reapply a user's skel with confirmation.""" users.reload() profiles.reload() groups.reload() title = _("Skeleton reapplying for group %s") % name data = '%s%s' % (w.backto(), __groups_actions(title)) if not sure: allusers = u.UsersList(configuration) allgroups = g.GroupsList(configuration, allusers) description = _('''This will reset the desktops, icons and menus of all members of the group, according to the content of the skel you choose. This will NOT alter any of the user personnal data, nor the group shared data.''') pri_group = allgroups.groups[allusers.users[users.UsersList.login_to_uid(login)]['gid']]['name'] # liste des skels du profile en cours. def filter_skels(pri_group, sk_list): ''' TODO: to be converted to licorn model if pri_group == configuration.mNames['RESPONSABLES_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['RESPONSABLES_GROUP']) != -1, sk_list) elif pri_group == configuration.mNames['USAGERS_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['USAGERS_GROUP']) != -1, sk_list) else: ''' return sk_list form_options = _("Which skel do you wish to reapply to members of this group? %s") \ % w.select("apply_skel", filter_skels(pri_group, configuration.users.skels), func = os.path.basename) data += w.question( _("Are you sure you want to reapply this skel to all of the members of %s?") % login, description, yes_values = [ _("Apply") + ' >>', "/users/skel/%s/sure" % login, _("A") ], no_values = [ '<< ' + _("Cancel"), "/groups/list", _("N") ], form_options = form_options) return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, '--apply-skel', skel ] return w.page(title, data + w.run(command, req, successfull_redirect = "/groups/list", err_msg = _("Failed to apply skel %s to members of group %s.") % (os.path.basename(apply_skel), login))) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
def skel(req, name, sure = False, apply_skel = configuration.users.default_skel): """ TO BE IMPLEMENTED ! reapply a user's skel with confirmation.""" users.reload() profiles.reload() groups.reload() title = _("Skeleton reapplying for group %s") % name data = '%s%s' % (w.backto(), __groups_actions(title)) if not sure: allusers = u.UsersList(configuration) allgroups = g.GroupsList(configuration, allusers) description = _('''This will reset the desktops, icons and menus of all members of the group, according to the content of the skel you choose. This will NOT alter any of the user personnal data, nor the group shared data.''') pri_group = allgroups.groups[allusers.users[users.UsersList.login_to_uid(login)]['gid']]['name'] # liste des skels du profile en cours. def filter_skels(pri_group, sk_list): ''' TODO: to be converted to licorn model if pri_group == configuration.mNames['RESPONSABLES_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['RESPONSABLES_GROUP']) != -1, sk_list) elif pri_group == configuration.mNames['USAGERS_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['USAGERS_GROUP']) != -1, sk_list) else: ''' return sk_list form_options = _("Which skel do you wish to reapply to members of this group? %s") \ % w.select("apply_skel", filter_skels(pri_group, configuration.users.skels), func = os.path.basename) data += w.question( _("Are you sure you want to reapply this skel to all of the members of %s?") % login, description, yes_values = [ _("Apply") + ' >>', "/users/skel/%s/sure" % login, _("A") ], no_values = [ '<< ' + _("Cancel"), "/groups/list", _("N") ], form_options = form_options) return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, '--apply-skel', skel ] return w.page(title, data + w.run(command, req, successfull_redirect = "/groups/list", err_msg = _("Failed to apply skel %s to members of group %s.") % (os.path.basename(apply_skel), login))) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
def skel(req, name, sure = False, apply_skel = configuration.users.default_skel): """ TO BE IMPLEMENTED ! reapply a user's skel with confirmation.""" users.reload() profiles.reload() groups.reload() title = _("Skeleton reapplying for group %s") % name data = '%s%s' % (w.backto(), __groups_actions(title)) if not sure: allusers = u.UsersList(configuration) allgroups = g.GroupsList(configuration, allusers) description = _('''This will reset the desktops, icons and menus of all members of the group, according to the content of the skel you choose. This will NOT alter any of the user personnal data, nor the group shared data.''') pri_group = allgroups.groups[allusers.users[users.UsersList.login_to_uid(login)]['gid']]['name'] # liste des skels du profile en cours. def filter_skels(pri_group, sk_list): ''' TODO: to be converted to licorn model if pri_group == configuration.mNames['RESPONSABLES_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['RESPONSABLES_GROUP']) != -1, sk_list) elif pri_group == configuration.mNames['USAGERS_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['USAGERS_GROUP']) != -1, sk_list) else: ''' return sk_list form_options = _("Which skel do you wish to reapply to members of this group? %s") \ % w.select("apply_skel", filter_skels(pri_group, configuration.users.skels), func = os.path.basename) data += w.question( _("Are you sure you want to reapply this skel to all of the members of %s?") % login, description, yes_values = [ _("Apply") + ' >>', "/users/skel/%s/sure" % login, _("A") ], no_values = [ '<< ' + _("Cancel"), "/groups/list", _("N") ], form_options = form_options) return w.page(title, data) else: # we are sure, do it ! command = [ "sudo", "mod", "user", "--quiet", "--no-colors", "--login", login, '--apply-skel', skel ] return w.page(title, data + w.run(command, req, successfull_redirect = "/groups/list", err_msg = _("Failed to apply skel %s to members of group %s.") % (os.path.basename(apply_skel), login))) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
def filter_skels(pri_group, sk_list): ''' TODO: to be converted to licorn model if pri_group == configuration.mNames['RESPONSABLES_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['RESPONSABLES_GROUP']) != -1, sk_list) elif pri_group == configuration.mNames['USAGERS_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['USAGERS_GROUP']) != -1, sk_list) else: ''' return sk_list | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
def filter_skels(pri_group, sk_list): ''' TODO: to be converted to licorn model if pri_group == configuration.mNames['RESPONSABLES_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['RESPONSABLES_GROUP']) != -1, sk_list) elif pri_group == configuration.mNames['USAGERS_GROUP']: return filter(lambda x: x.rfind("/%s/" % configuration.mNames['USAGERS_GROUP']) != -1, sk_list) else: ''' return sk_list | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
<td></td> | <td></td> | def new(uri, http_user): """Generate a form to create a new group on the system.""" title = _("Creating a new group") data = w.page_body_start(uri, http_user, ctxtnav, title, False) form_name = "group_create_form" data += '''<div id="edit_form"> | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
def create(uri, http_user, name, description = None, skel = "", permissive = False, create = None): title = _("Creating group %s") % name data = '%s<h1>%s</h1><br />' % (w.backto(), title) del create command = [ 'sudo', 'add', 'group', '--quiet', '--no-colors', '--name', name, '--skel', skel ] if description: command.extend([ '--description', description ]) if permissive: command.append('--permissive') return w.page(title, data + w.run(command, uri, successfull_redirect = "/groups/list", err_msg = _('Failed to create group %s!') % name)) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
def create(uri, http_user, name, description = None, skel = "", permissive = False, create = None): title = _("Creating group %s") % name data = '%s<h1>%s</h1><br />' % (w.backto(), title) del create command = [ 'sudo', 'add', 'group', '--quiet', '--no-colors', '--name', name, '--skel', skel ] if description: command.extend([ '--description', description ]) if permissive: command.append('--permissive') return w.page(title, data + w.run(command, uri, successfull_redirect = "/groups/list", err_msg = _('Failed to create group %s!') % name)) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
def create(uri, http_user, name, description = None, skel = "", permissive = False, create = None): title = _("Creating group %s") % name data = '%s<h1>%s</h1><br />' % (w.backto(), title) del create command = [ 'sudo', 'add', 'group', '--quiet', '--no-colors', '--name', name, '--skel', skel ] if description: command.extend([ '--description', description ]) if permissive: command.append('--permissive') return w.page(title, data + w.run(command, uri, successfull_redirect = "/groups/list", err_msg = _('Failed to create group %s!') % name)) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
def create(uri, http_user, name, description = None, skel = "", permissive = False, create = None): title = _("Creating group %s") % name data = '%s<h1>%s</h1><br />' % (w.backto(), title) del create command = [ 'sudo', 'add', 'group', '--quiet', '--no-colors', '--name', name, '--skel', skel ] if description: command.extend([ '--description', description ]) if permissive: command.append('--permissive') return w.page(title, data + w.run(command, uri, successfull_redirect = "/groups/list", err_msg = _('Failed to create group %s!') % name)) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
title = _("Showing details of group %s") % name | title = _("Showing details of group %s") % name | def view(uri, http_user, name): """Prepare a group view to be printed.""" users.reload() groups.reload() title = _("Showing details of group %s") % name data = '%s\n%s\n%s\n' % (w.backto(), __groups_actions(), w.menu(uri)) u = users.users g = groups.groups # TODO: should we forbid system group view ? why not ? # As of now, this is harmless and I don't see any reason # apart from obfuscation which is not acceptable. # Anyway, to see a system group, user must forge an URL. try: group = g[groups.name_to_gid(name)] members = groups.all_members(name) members.sort() members_html = ''' <h2>%s</h2><div style="text-align:center;">%s</div> <table class="group_members"> <tr> <td><strong>%s</strong></td> <th><strong>%s</strong></th> <th><strong>%s</strong></th> </tr> ''' % (_('Members'), _('(ordered by login)'), _('Full Name'), _('Identifier'), _('UID')) def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % (u[uid]['gecos'], login, uid) members_html += "\n".join(map(user_line, members)) + '</table>' if not groups.is_system_group(name): resps = groups.all_members(configuration.groups.resp_prefix + name) resps.sort() guests = groups.all_members(configuration.groups.guest_prefix + name) guests.sort() if resps != []: resps_html = ''' <h2>%s</h2><div style="text-align:center;">%s</div> <table class="group_members"> <tr> <th><strong>%s</strong></th> <th><strong>%s</strong></th> <th><strong>%s</strong></th> </tr> %s </table> ''' % (_('Responsibles'), _('(ordered by login)'), _('Full Name'), _('Identifier'), _('UID'), "\n".join(map(user_line, resps))) else: resps_html = "<h2>%s</h2>" % _('No responsibles for this group.') if guests != []: guests_html = ''' <h2>%s</h2><div style="text-align:center;">%s</div> <table class="group_members"> <tr> <th><strong>%s</strong></th> <th><strong>%s</strong></th> <th><strong>%s</strong></th> </tr> %s </table> ''' % (_('Guests'), _('(ordered by login)'), _('Full Name'), _('Identifier'), _('UID'), "\n".join(map(user_line, guests))) else: guests_html = "<h2>%s</h2>" % _('No guests for this group.') else: resps_html = guests_html = '' form_name = "group_print_form" data += ''' <div id="content"> <form name="%s" id="%s" action="/groups/view/%s" method="post"> <table id="user_account"> <tr><td><strong>%s</strong><br />%s</td><td class="not_modifiable">%d</td></tr> <tr><td><strong>%s</strong><br />%s</td><td class="not_modifiable">%s</td></tr> <tr><td colspan="2" class="double_selector">%s</td></tr> <tr><td colspan="2" class="double_selector">%s</td></tr> <tr><td colspan="2" class="double_selector">%s</td></tr> <tr> <td>%s</td> <td class="right">%s</td> </tr> </table> </form> </div> ''' % ( form_name, form_name, name, _('GID'), _('immutable'), group['gid'], _('Name'), _('immutable'), name, members_html, resps_html, guests_html, w.button(_('<< Go back'), "/groups/list", accesskey = _('B')), w.submit('print', _('Print') + ' >>', onClick = "javascript:window.print(); return false;", accesskey = _('P')) ) except exceptions.LicornException, e: data += w.error(_("Group %s doesn't exist (%s, %s)!") % (name, "group = g[groups.name_to_gid(name)]", e)) return w.page(title, data) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
def view(uri, http_user, name): """Prepare a group view to be printed.""" users.reload() groups.reload() title = _("Showing details of group %s") % name data = '%s\n%s\n%s\n' % (w.backto(), __groups_actions(), w.menu(uri)) u = users.users g = groups.groups # TODO: should we forbid system group view ? why not ? # As of now, this is harmless and I don't see any reason # apart from obfuscation which is not acceptable. # Anyway, to see a system group, user must forge an URL. try: group = g[groups.name_to_gid(name)] members = groups.all_members(name) members.sort() members_html = ''' <h2>%s</h2><div style="text-align:center;">%s</div> <table class="group_members"> <tr> <td><strong>%s</strong></td> <th><strong>%s</strong></th> <th><strong>%s</strong></th> </tr> ''' % (_('Members'), _('(ordered by login)'), _('Full Name'), _('Identifier'), _('UID')) def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % (u[uid]['gecos'], login, uid) members_html += "\n".join(map(user_line, members)) + '</table>' if not groups.is_system_group(name): resps = groups.all_members(configuration.groups.resp_prefix + name) resps.sort() guests = groups.all_members(configuration.groups.guest_prefix + name) guests.sort() if resps != []: resps_html = ''' <h2>%s</h2><div style="text-align:center;">%s</div> <table class="group_members"> <tr> <th><strong>%s</strong></th> <th><strong>%s</strong></th> <th><strong>%s</strong></th> </tr> %s </table> ''' % (_('Responsibles'), _('(ordered by login)'), _('Full Name'), _('Identifier'), _('UID'), "\n".join(map(user_line, resps))) else: resps_html = "<h2>%s</h2>" % _('No responsibles for this group.') if guests != []: guests_html = ''' <h2>%s</h2><div style="text-align:center;">%s</div> <table class="group_members"> <tr> <th><strong>%s</strong></th> <th><strong>%s</strong></th> <th><strong>%s</strong></th> </tr> %s </table> ''' % (_('Guests'), _('(ordered by login)'), _('Full Name'), _('Identifier'), _('UID'), "\n".join(map(user_line, guests))) else: guests_html = "<h2>%s</h2>" % _('No guests for this group.') else: resps_html = guests_html = '' form_name = "group_print_form" data += ''' <div id="content"> <form name="%s" id="%s" action="/groups/view/%s" method="post"> <table id="user_account"> <tr><td><strong>%s</strong><br />%s</td><td class="not_modifiable">%d</td></tr> <tr><td><strong>%s</strong><br />%s</td><td class="not_modifiable">%s</td></tr> <tr><td colspan="2" class="double_selector">%s</td></tr> <tr><td colspan="2" class="double_selector">%s</td></tr> <tr><td colspan="2" class="double_selector">%s</td></tr> <tr> <td>%s</td> <td class="right">%s</td> </tr> </table> </form> </div> ''' % ( form_name, form_name, name, _('GID'), _('immutable'), group['gid'], _('Name'), _('immutable'), name, members_html, resps_html, guests_html, w.button(_('<< Go back'), "/groups/list", accesskey = _('B')), w.submit('print', _('Print') + ' >>', onClick = "javascript:window.print(); return false;", accesskey = _('P')) ) except exceptions.LicornException, e: data += w.error(_("Group %s doesn't exist (%s, %s)!") % (name, "group = g[groups.name_to_gid(name)]", e)) return w.page(title, data) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
''' % (_('Guests'), _('(ordered by login)'), | ''' % (_('Guests'), _('(ordered by login)'), | def user_line(login): uid = users.login_to_uid(login) return '''<tr><td>%s</td><td>%s</td><td>%s</td></tr>''' % (u[uid]['gecos'], login, uid) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
def edit(uri, http_user, name): """Edit a group.""" users.reload() groups.reload() u = users.users g = groups.groups title = _("Editing group %s") % name data = w.page_body_start(uri, http_user, ctxtnav, title, False) try: group = g[groups.name_to_gid(name)] sys = groups.is_system_group(name) dbl_lists = {} if sys: groups_filters_lists_ids = ( (name, ( _('Manage members'), _('Users not yet members'), _('Current members') ), 'members' ), (configuration.groups.resp_prefix + name, None, ' ' ), (configuration.groups.guest_prefix + name, None, ' ' ) ) else: groups_filters_lists_ids = ( (name, [_('Manage members'), _('Users not yet members'), _('Current members')], 'members'), (configuration.groups.resp_prefix + name, [_('Manage responsibles'), _('Users not yet responsibles'), _('Current responsibles')], 'resps'), (configuration.groups.guest_prefix + name, [_('Manage guests'), _('Users not yet guests'), _('Current guests')], 'guests') ) for (gname, titles, id) in groups_filters_lists_ids: if titles is None: dbl_lists[gname] = id else: users.Select(users.FILTER_STANDARD) dest = g[groups.name_to_gid(gname)]['members'][:] source = [ u[uid]['login'] for uid in users.filtered_users ] for current in g[groups.name_to_gid(gname)]['members']: try: source.remove(current) except ValueError: dest.remove(current) dest.sort() source.sort() dbl_lists[gname] = w.doubleListBox(titles, id, source, dest) def descr(desc, system): if system: return desc else: return w.input('description', desc, size = 30, maxlength = 256, accesskey = 'D') def skel(cur_skel, system): if system: return '' else: return ''' <tr> <td><strong>%s</strong></td> <td class="right">%s</td> </tr> ''' % (_('Skeleton'), w.select('skel', configuration.users.skels, cur_skel, func = os.path.basename)) def permissive(perm, sys): if sys: return '' else: return ''' <tr> <td><strong>%s</strong></td> <td class="right">%s</td> </tr> ''' % (_('Permissive shared dir?'), w.checkbox('permissive', "True", "Oui", checked = perm )) form_name = "group_edit_form" data += '''<div id="edit_form"> | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
groups_filters_lists_ids = ( | groups_filters_lists_ids = ( | def edit(uri, http_user, name): """Edit a group.""" users.reload() groups.reload() u = users.users g = groups.groups title = _("Editing group %s") % name data = w.page_body_start(uri, http_user, ctxtnav, title, False) try: group = g[groups.name_to_gid(name)] sys = groups.is_system_group(name) dbl_lists = {} if sys: groups_filters_lists_ids = ( (name, ( _('Manage members'), _('Users not yet members'), _('Current members') ), 'members' ), (configuration.groups.resp_prefix + name, None, ' ' ), (configuration.groups.guest_prefix + name, None, ' ' ) ) else: groups_filters_lists_ids = ( (name, [_('Manage members'), _('Users not yet members'), _('Current members')], 'members'), (configuration.groups.resp_prefix + name, [_('Manage responsibles'), _('Users not yet responsibles'), _('Current responsibles')], 'resps'), (configuration.groups.guest_prefix + name, [_('Manage guests'), _('Users not yet guests'), _('Current guests')], 'guests') ) for (gname, titles, id) in groups_filters_lists_ids: if titles is None: dbl_lists[gname] = id else: users.Select(users.FILTER_STANDARD) dest = g[groups.name_to_gid(gname)]['members'][:] source = [ u[uid]['login'] for uid in users.filtered_users ] for current in g[groups.name_to_gid(gname)]['members']: try: source.remove(current) except ValueError: dest.remove(current) dest.sort() source.sort() dbl_lists[gname] = w.doubleListBox(titles, id, source, dest) def descr(desc, system): if system: return desc else: return w.input('description', desc, size = 30, maxlength = 256, accesskey = 'D') def skel(cur_skel, system): if system: return '' else: return ''' <tr> <td><strong>%s</strong></td> <td class="right">%s</td> </tr> ''' % (_('Skeleton'), w.select('skel', configuration.users.skels, cur_skel, func = os.path.basename)) def permissive(perm, sys): if sys: return '' else: return ''' <tr> <td><strong>%s</strong></td> <td class="right">%s</td> </tr> ''' % (_('Permissive shared dir?'), w.checkbox('permissive', "True", "Oui", checked = perm )) form_name = "group_edit_form" data += '''<div id="edit_form"> | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
groups_filters_lists_ids = ( | groups_filters_lists_ids = ( | def edit(uri, http_user, name): """Edit a group.""" users.reload() groups.reload() u = users.users g = groups.groups title = _("Editing group %s") % name data = w.page_body_start(uri, http_user, ctxtnav, title, False) try: group = g[groups.name_to_gid(name)] sys = groups.is_system_group(name) dbl_lists = {} if sys: groups_filters_lists_ids = ( (name, ( _('Manage members'), _('Users not yet members'), _('Current members') ), 'members' ), (configuration.groups.resp_prefix + name, None, ' ' ), (configuration.groups.guest_prefix + name, None, ' ' ) ) else: groups_filters_lists_ids = ( (name, [_('Manage members'), _('Users not yet members'), _('Current members')], 'members'), (configuration.groups.resp_prefix + name, [_('Manage responsibles'), _('Users not yet responsibles'), _('Current responsibles')], 'resps'), (configuration.groups.guest_prefix + name, [_('Manage guests'), _('Users not yet guests'), _('Current guests')], 'guests') ) for (gname, titles, id) in groups_filters_lists_ids: if titles is None: dbl_lists[gname] = id else: users.Select(users.FILTER_STANDARD) dest = g[groups.name_to_gid(gname)]['members'][:] source = [ u[uid]['login'] for uid in users.filtered_users ] for current in g[groups.name_to_gid(gname)]['members']: try: source.remove(current) except ValueError: dest.remove(current) dest.sort() source.sort() dbl_lists[gname] = w.doubleListBox(titles, id, source, dest) def descr(desc, system): if system: return desc else: return w.input('description', desc, size = 30, maxlength = 256, accesskey = 'D') def skel(cur_skel, system): if system: return '' else: return ''' <tr> <td><strong>%s</strong></td> <td class="right">%s</td> </tr> ''' % (_('Skeleton'), w.select('skel', configuration.users.skels, cur_skel, func = os.path.basename)) def permissive(perm, sys): if sys: return '' else: return ''' <tr> <td><strong>%s</strong></td> <td class="right">%s</td> </tr> ''' % (_('Permissive shared dir?'), w.checkbox('permissive', "True", "Oui", checked = perm )) form_name = "group_edit_form" data += '''<div id="edit_form"> | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
(configuration.groups.resp_prefix + name, [_('Manage responsibles'), _('Users not yet responsibles'), _('Current responsibles')], 'resps'), | (configuration.groups.resp_prefix + name, [_('Manage responsibles'), _('Users not yet responsibles'), _('Current responsibles')], 'resps'), | def edit(uri, http_user, name): """Edit a group.""" users.reload() groups.reload() u = users.users g = groups.groups title = _("Editing group %s") % name data = w.page_body_start(uri, http_user, ctxtnav, title, False) try: group = g[groups.name_to_gid(name)] sys = groups.is_system_group(name) dbl_lists = {} if sys: groups_filters_lists_ids = ( (name, ( _('Manage members'), _('Users not yet members'), _('Current members') ), 'members' ), (configuration.groups.resp_prefix + name, None, ' ' ), (configuration.groups.guest_prefix + name, None, ' ' ) ) else: groups_filters_lists_ids = ( (name, [_('Manage members'), _('Users not yet members'), _('Current members')], 'members'), (configuration.groups.resp_prefix + name, [_('Manage responsibles'), _('Users not yet responsibles'), _('Current responsibles')], 'resps'), (configuration.groups.guest_prefix + name, [_('Manage guests'), _('Users not yet guests'), _('Current guests')], 'guests') ) for (gname, titles, id) in groups_filters_lists_ids: if titles is None: dbl_lists[gname] = id else: users.Select(users.FILTER_STANDARD) dest = g[groups.name_to_gid(gname)]['members'][:] source = [ u[uid]['login'] for uid in users.filtered_users ] for current in g[groups.name_to_gid(gname)]['members']: try: source.remove(current) except ValueError: dest.remove(current) dest.sort() source.sort() dbl_lists[gname] = w.doubleListBox(titles, id, source, dest) def descr(desc, system): if system: return desc else: return w.input('description', desc, size = 30, maxlength = 256, accesskey = 'D') def skel(cur_skel, system): if system: return '' else: return ''' <tr> <td><strong>%s</strong></td> <td class="right">%s</td> </tr> ''' % (_('Skeleton'), w.select('skel', configuration.users.skels, cur_skel, func = os.path.basename)) def permissive(perm, sys): if sys: return '' else: return ''' <tr> <td><strong>%s</strong></td> <td class="right">%s</td> </tr> ''' % (_('Permissive shared dir?'), w.checkbox('permissive', "True", "Oui", checked = perm )) form_name = "group_edit_form" data += '''<div id="edit_form"> | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
permissive(group['permissive'], sys), | permissive(group['permissive'], sys), | def permissive(perm, sys): | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
skel(group['skel'], sys), | skel(group['skel'], sys), | def permissive(perm, sys): | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
def permissive(perm, sys): | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
return w.page(title, | return w.page(title, | def record(uri, http_user, name, skel = None, permissive = False, description = None, members_source = [], members_dest = [], resps_source = [], resps_dest = [], guests_source = [], guests_dest = [], record = None): """Record group changes.""" # forget about it, this is a scoria from the POST FORM to variable conversion. del record title = _("Modifying group %s") % name data = '%s<h1>%s</h1>' % (w.backto(), title) command = [ 'sudo', 'mod', 'group', '--quiet', '--no-colors', '--name', name ] if skel: command.extend([ "--skel", skel ]) add_members = ','.join(__merge_multi_select(members_dest)) del_members = ','.join(__merge_multi_select(members_source)) add_resps = ','.join(__merge_multi_select(resps_dest)) del_resps = ','.join(__merge_multi_select(resps_source)) add_guests = ','.join(__merge_multi_select(guests_dest)) del_guests = ','.join(__merge_multi_select(guests_source)) for (var, cmd) in ( (add_members, "--add-users"), (del_members, "--del-users"), (add_resps, "--add-resps"), (del_resps, '--del-resps'), (add_guests, "--add-guests"), (del_guests, '--del-guests') ): if var != "": command.extend([ cmd, var ]) return w.page(title, data + w.run(command, uri, successfull_redirect = "/groups/list", err_msg = _('Failed to modify one or more parameter of group %s!') % name)) | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
def main(uri, http_user, sort = "name", order = "asc"): start = time.time() users.reload() groups.reload() #reload(p) g = groups.groups users.Select(users.FILTER_STANDARD) tgroups = {} totals = {} title = "%s" % configuration.groups.names['_plural'] data = w.page_body_start(uri, http_user, ctxtnav, title) if order == "asc": reverseorder = "desc" else: reverseorder = "asc" data += '<table>\n <tr>\n' sortcols = ( ('', '', False), ("name", _("Name"), True), ("skel", _("Skeleton"), True), ("permissive", _("Perm."), True), ('members', "Members", False), ("resps", _("Responsibles"), False), ("guests", _("Guests"), False) ) for (column, name, can_sort) in sortcols: if can_sort: if column == sort: data += ''' <th><img src="/images/sort_%s.gif" alt="%s" />  <a href="/groups/list/%s/%s" title="%s">%s</a> </th>\n''' % (order, _('%s order') % order, column, reverseorder, _('Click to sort in reverse order.'), name) else: data += ' <th><a href="/groups/list/%s/asc" title="%s">%s</a></th>\n' % (column, _('Click to sort on this column.'), name) else: data += ' <th>%s</th>\n' % name data += ' </tr>\n' for (filter, filter_name) in ( (groups.FILTER_STANDARD, configuration.groups.names['_plural']), (groups.FILTER_PRIVILEGED, _("Privileges")) ): tgroups = {} ordered = {} totals[filter_name] = 0 groups.Select(filter) for gid in groups.filtered_groups: group = groups.groups[gid] name = group['name'] tgroups[gid] = { 'name' : name, 'skel' : group['skel'] + name, 'permissive': group['permissive'] } totals[filter_name] += 1 # index on the column choosen for sorting, and keep trace of the uid # to find account data back after ordering. ordered[hlstr.validate_name(tgroups[gid][sort])] = gid tgroups[gid]['members'] = [] for member in groups.groups[gid]['members']: if not users.is_system_login(member): tgroups[gid]['members'].append(users.users[users.login_to_uid(member)]) if not groups.is_system_gid(gid): for prefix in (configuration.groups.resp_prefix, configuration.groups.guest_prefix): tgroups[gid][prefix + 'members'] = [] for member in groups.groups[groups.name_to_gid(prefix + name)]['members']: if not users.is_system_login(member): tgroups[gid][prefix + 'members'].append(users.users[users.login_to_uid(member)]) gkeys = ordered.keys() gkeys.sort() if order == "desc": gkeys.reverse() def html_build_group(index, tgroups = tgroups ): gid = ordered[index] name = g[gid]['name'] html_data = ''' <tr class="userdata"> <td class="nopadding"><a href="/groups/view/%s" title="Visualiser le groupe, ses paramètres, ses membres, responsables et invités, en vue de les imprimer."><img src="/images/16x16/preview.png" alt="prévisualiser le groupe et ses données." /></a></td> <td class="group_name"> <a href="/groups/edit/%s" title="%s"><img src="/images/16x16/edit.png" alt="éditer les paramètres du groupe."/> %s</a> </td> <td class="right"> <a href="/groups/edit/%s">%s</a> </td> ''' % (name, name, g[gid]['description'], name, name, g[gid]['skel']) if groups.is_system_gid(gid): html_data += '<td> </td>' else: if g[gid]['permissive']: html_data += ''' <td class="user_action_center"> <a href="/groups/lock/%s" title="%s"> <img src="/images/16x16/unlocked.png" alt="%s"/></a> </td> ''' % (name, _('Shared group directory is currently <strong>permissive</strong>. Click to deactivate permissiveness.'), _('Group is currently permissive.')) else: html_data += ''' <td class="user_action_center"> <a href="/groups/unlock/%s" title="%s"> <img src="/images/16x16/locked.png" alt="%sø"/></a> </td> ''' % (name, _('Shared group directory is currently <strong>NOT</strong> permissive. Click ti activate permissiveness.'), _('Group is NOT permissive.')) for (keyname, text) in (('members', _('Current members')), ('rsp-members', _('Current responsibles')), ('gst-members', _('Current guests')) ): if tgroups[gid].has_key(keyname): accounts = {} uordered = {} for member in tgroups[gid][keyname]: uid = member['uid'] accounts[uid] = { 'login': member['login'], 'gecos': member['gecos'], 'gecos_sort': member['gecos'] + member['login'] } uordered[hlstr.validate_name(accounts[uid]['gecos_sort'], aggressive = True)] = uid memberkeys = uordered.keys() memberkeys.sort() mbdata = "<table><tr><th>%s</th><th>%s</th><th>%s</th></tr>\n" % (_('Full Name'), _('Identifier'), _('UID')) for member in memberkeys: uid = uordered[member] mbdata += '''<tr><td>%s</td><td>%s</td><td>%d</td></tr>\n''' % (accounts[uid]['gecos'], accounts[uid]['login'], uid) mbdata += '</table>' nb = len(tgroups[gid][keyname]) if nb == 0: html_data += '''<td class="right faded">%s</td>\n''' % _('none') else: html_data += '''<td class="right"><a class="nounder" title="<h4>%s</h4><br />%s"><strong>%d</strong> <img src="/images/16x16/details-light.png" alt="%s" /></a></td>\n''' % (text, mbdata, nb, _('See %s of group %s.') % (text, name)) else: html_data += '''<td> </td>\n''' if groups.is_system_gid(gid): html_data += '<td colspan="1"> </td></tr>\n' else: html_data += ''' <!-- <td class="user_action"> <a href="/users/skel/%s" title="%s"> <img src="/images/16x16/reapply-skel.png" alt="%s"/></a> </td> --> <td class="user_action"> <a href="/groups/delete/%s" title="%s"> <img src="/images/16x16/delete.png" alt="%s"/></a> </td> </tr> ''' % (name, _('This will rebuild his/her desktop from scratch, with defaults icons and so on.<br /><br />The user must be disconnected for the operation to be completely successfull.'), _('Reapply skel to group members.'), name, _('Definitely remove this group from system.'), _('Remove this group.')) return html_data data += '<tr><td class="group_class" colspan="8">%s</td></tr>\n%s' % (filter_name, ''.join(map(html_build_group, gkeys))) def print_totals(totals): output = "" for total in totals: if totals[total] != 0: output += ''' <tr class="list_total"> <td colspan="6" class="total_left">%s</td> <td colspan="6" class="total_right">%d</td> </tr> ''' % (_('number of <strong>%s</strong>:') % total, totals[total]) return output data += ''' <tr> <td colspan="6"> </td></tr> %s <tr class="list_total"> <td colspan="6" class="total_left"><strong>%s</strong></td> <td colspan="6" class="total_right">%d</td> </tr> | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
def main(uri, http_user, sort = "name", order = "asc"): start = time.time() users.reload() groups.reload() #reload(p) g = groups.groups users.Select(users.FILTER_STANDARD) tgroups = {} totals = {} title = "%s" % configuration.groups.names['_plural'] data = w.page_body_start(uri, http_user, ctxtnav, title) if order == "asc": reverseorder = "desc" else: reverseorder = "asc" data += '<table>\n <tr>\n' sortcols = ( ('', '', False), ("name", _("Name"), True), ("skel", _("Skeleton"), True), ("permissive", _("Perm."), True), ('members', "Members", False), ("resps", _("Responsibles"), False), ("guests", _("Guests"), False) ) for (column, name, can_sort) in sortcols: if can_sort: if column == sort: data += ''' <th><img src="/images/sort_%s.gif" alt="%s" />  <a href="/groups/list/%s/%s" title="%s">%s</a> </th>\n''' % (order, _('%s order') % order, column, reverseorder, _('Click to sort in reverse order.'), name) else: data += ' <th><a href="/groups/list/%s/asc" title="%s">%s</a></th>\n' % (column, _('Click to sort on this column.'), name) else: data += ' <th>%s</th>\n' % name data += ' </tr>\n' for (filter, filter_name) in ( (groups.FILTER_STANDARD, configuration.groups.names['_plural']), (groups.FILTER_PRIVILEGED, _("Privileges")) ): tgroups = {} ordered = {} totals[filter_name] = 0 groups.Select(filter) for gid in groups.filtered_groups: group = groups.groups[gid] name = group['name'] tgroups[gid] = { 'name' : name, 'skel' : group['skel'] + name, 'permissive': group['permissive'] } totals[filter_name] += 1 # index on the column choosen for sorting, and keep trace of the uid # to find account data back after ordering. ordered[hlstr.validate_name(tgroups[gid][sort])] = gid tgroups[gid]['members'] = [] for member in groups.groups[gid]['members']: if not users.is_system_login(member): tgroups[gid]['members'].append(users.users[users.login_to_uid(member)]) if not groups.is_system_gid(gid): for prefix in (configuration.groups.resp_prefix, configuration.groups.guest_prefix): tgroups[gid][prefix + 'members'] = [] for member in groups.groups[groups.name_to_gid(prefix + name)]['members']: if not users.is_system_login(member): tgroups[gid][prefix + 'members'].append(users.users[users.login_to_uid(member)]) gkeys = ordered.keys() gkeys.sort() if order == "desc": gkeys.reverse() def html_build_group(index, tgroups = tgroups ): gid = ordered[index] name = g[gid]['name'] html_data = ''' <tr class="userdata"> <td class="nopadding"><a href="/groups/view/%s" title="Visualiser le groupe, ses paramètres, ses membres, responsables et invités, en vue de les imprimer."><img src="/images/16x16/preview.png" alt="prévisualiser le groupe et ses données." /></a></td> <td class="group_name"> <a href="/groups/edit/%s" title="%s"><img src="/images/16x16/edit.png" alt="éditer les paramètres du groupe."/> %s</a> </td> <td class="right"> <a href="/groups/edit/%s">%s</a> </td> ''' % (name, name, g[gid]['description'], name, name, g[gid]['skel']) if groups.is_system_gid(gid): html_data += '<td> </td>' else: if g[gid]['permissive']: html_data += ''' <td class="user_action_center"> <a href="/groups/lock/%s" title="%s"> <img src="/images/16x16/unlocked.png" alt="%s"/></a> </td> ''' % (name, _('Shared group directory is currently <strong>permissive</strong>. Click to deactivate permissiveness.'), _('Group is currently permissive.')) else: html_data += ''' <td class="user_action_center"> <a href="/groups/unlock/%s" title="%s"> <img src="/images/16x16/locked.png" alt="%sø"/></a> </td> ''' % (name, _('Shared group directory is currently <strong>NOT</strong> permissive. Click ti activate permissiveness.'), _('Group is NOT permissive.')) for (keyname, text) in (('members', _('Current members')), ('rsp-members', _('Current responsibles')), ('gst-members', _('Current guests')) ): if tgroups[gid].has_key(keyname): accounts = {} uordered = {} for member in tgroups[gid][keyname]: uid = member['uid'] accounts[uid] = { 'login': member['login'], 'gecos': member['gecos'], 'gecos_sort': member['gecos'] + member['login'] } uordered[hlstr.validate_name(accounts[uid]['gecos_sort'], aggressive = True)] = uid memberkeys = uordered.keys() memberkeys.sort() mbdata = "<table><tr><th>%s</th><th>%s</th><th>%s</th></tr>\n" % (_('Full Name'), _('Identifier'), _('UID')) for member in memberkeys: uid = uordered[member] mbdata += '''<tr><td>%s</td><td>%s</td><td>%d</td></tr>\n''' % (accounts[uid]['gecos'], accounts[uid]['login'], uid) mbdata += '</table>' nb = len(tgroups[gid][keyname]) if nb == 0: html_data += '''<td class="right faded">%s</td>\n''' % _('none') else: html_data += '''<td class="right"><a class="nounder" title="<h4>%s</h4><br />%s"><strong>%d</strong> <img src="/images/16x16/details-light.png" alt="%s" /></a></td>\n''' % (text, mbdata, nb, _('See %s of group %s.') % (text, name)) else: html_data += '''<td> </td>\n''' if groups.is_system_gid(gid): html_data += '<td colspan="1"> </td></tr>\n' else: html_data += ''' <!-- <td class="user_action"> <a href="/users/skel/%s" title="%s"> <img src="/images/16x16/reapply-skel.png" alt="%s"/></a> </td> --> <td class="user_action"> <a href="/groups/delete/%s" title="%s"> <img src="/images/16x16/delete.png" alt="%s"/></a> </td> </tr> ''' % (name, _('This will rebuild his/her desktop from scratch, with defaults icons and so on.<br /><br />The user must be disconnected for the operation to be completely successfull.'), _('Reapply skel to group members.'), name, _('Definitely remove this group from system.'), _('Remove this group.')) return html_data data += '<tr><td class="group_class" colspan="8">%s</td></tr>\n%s' % (filter_name, ''.join(map(html_build_group, gkeys))) def print_totals(totals): output = "" for total in totals: if totals[total] != 0: output += ''' <tr class="list_total"> <td colspan="6" class="total_left">%s</td> <td colspan="6" class="total_right">%d</td> </tr> ''' % (_('number of <strong>%s</strong>:') % total, totals[total]) return output data += ''' <tr> <td colspan="6"> </td></tr> %s <tr class="list_total"> <td colspan="6" class="total_left"><strong>%s</strong></td> <td colspan="6" class="total_right">%d</td> </tr> | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
def main(uri, http_user, sort = "name", order = "asc"): start = time.time() users.reload() groups.reload() #reload(p) g = groups.groups users.Select(users.FILTER_STANDARD) tgroups = {} totals = {} title = "%s" % configuration.groups.names['_plural'] data = w.page_body_start(uri, http_user, ctxtnav, title) if order == "asc": reverseorder = "desc" else: reverseorder = "asc" data += '<table>\n <tr>\n' sortcols = ( ('', '', False), ("name", _("Name"), True), ("skel", _("Skeleton"), True), ("permissive", _("Perm."), True), ('members', "Members", False), ("resps", _("Responsibles"), False), ("guests", _("Guests"), False) ) for (column, name, can_sort) in sortcols: if can_sort: if column == sort: data += ''' <th><img src="/images/sort_%s.gif" alt="%s" />  <a href="/groups/list/%s/%s" title="%s">%s</a> </th>\n''' % (order, _('%s order') % order, column, reverseorder, _('Click to sort in reverse order.'), name) else: data += ' <th><a href="/groups/list/%s/asc" title="%s">%s</a></th>\n' % (column, _('Click to sort on this column.'), name) else: data += ' <th>%s</th>\n' % name data += ' </tr>\n' for (filter, filter_name) in ( (groups.FILTER_STANDARD, configuration.groups.names['_plural']), (groups.FILTER_PRIVILEGED, _("Privileges")) ): tgroups = {} ordered = {} totals[filter_name] = 0 groups.Select(filter) for gid in groups.filtered_groups: group = groups.groups[gid] name = group['name'] tgroups[gid] = { 'name' : name, 'skel' : group['skel'] + name, 'permissive': group['permissive'] } totals[filter_name] += 1 # index on the column choosen for sorting, and keep trace of the uid # to find account data back after ordering. ordered[hlstr.validate_name(tgroups[gid][sort])] = gid tgroups[gid]['members'] = [] for member in groups.groups[gid]['members']: if not users.is_system_login(member): tgroups[gid]['members'].append(users.users[users.login_to_uid(member)]) if not groups.is_system_gid(gid): for prefix in (configuration.groups.resp_prefix, configuration.groups.guest_prefix): tgroups[gid][prefix + 'members'] = [] for member in groups.groups[groups.name_to_gid(prefix + name)]['members']: if not users.is_system_login(member): tgroups[gid][prefix + 'members'].append(users.users[users.login_to_uid(member)]) gkeys = ordered.keys() gkeys.sort() if order == "desc": gkeys.reverse() def html_build_group(index, tgroups = tgroups ): gid = ordered[index] name = g[gid]['name'] html_data = ''' <tr class="userdata"> <td class="nopadding"><a href="/groups/view/%s" title="Visualiser le groupe, ses paramètres, ses membres, responsables et invités, en vue de les imprimer."><img src="/images/16x16/preview.png" alt="prévisualiser le groupe et ses données." /></a></td> <td class="group_name"> <a href="/groups/edit/%s" title="%s"><img src="/images/16x16/edit.png" alt="éditer les paramètres du groupe."/> %s</a> </td> <td class="right"> <a href="/groups/edit/%s">%s</a> </td> ''' % (name, name, g[gid]['description'], name, name, g[gid]['skel']) if groups.is_system_gid(gid): html_data += '<td> </td>' else: if g[gid]['permissive']: html_data += ''' <td class="user_action_center"> <a href="/groups/lock/%s" title="%s"> <img src="/images/16x16/unlocked.png" alt="%s"/></a> </td> ''' % (name, _('Shared group directory is currently <strong>permissive</strong>. Click to deactivate permissiveness.'), _('Group is currently permissive.')) else: html_data += ''' <td class="user_action_center"> <a href="/groups/unlock/%s" title="%s"> <img src="/images/16x16/locked.png" alt="%sø"/></a> </td> ''' % (name, _('Shared group directory is currently <strong>NOT</strong> permissive. Click ti activate permissiveness.'), _('Group is NOT permissive.')) for (keyname, text) in (('members', _('Current members')), ('rsp-members', _('Current responsibles')), ('gst-members', _('Current guests')) ): if tgroups[gid].has_key(keyname): accounts = {} uordered = {} for member in tgroups[gid][keyname]: uid = member['uid'] accounts[uid] = { 'login': member['login'], 'gecos': member['gecos'], 'gecos_sort': member['gecos'] + member['login'] } uordered[hlstr.validate_name(accounts[uid]['gecos_sort'], aggressive = True)] = uid memberkeys = uordered.keys() memberkeys.sort() mbdata = "<table><tr><th>%s</th><th>%s</th><th>%s</th></tr>\n" % (_('Full Name'), _('Identifier'), _('UID')) for member in memberkeys: uid = uordered[member] mbdata += '''<tr><td>%s</td><td>%s</td><td>%d</td></tr>\n''' % (accounts[uid]['gecos'], accounts[uid]['login'], uid) mbdata += '</table>' nb = len(tgroups[gid][keyname]) if nb == 0: html_data += '''<td class="right faded">%s</td>\n''' % _('none') else: html_data += '''<td class="right"><a class="nounder" title="<h4>%s</h4><br />%s"><strong>%d</strong> <img src="/images/16x16/details-light.png" alt="%s" /></a></td>\n''' % (text, mbdata, nb, _('See %s of group %s.') % (text, name)) else: html_data += '''<td> </td>\n''' if groups.is_system_gid(gid): html_data += '<td colspan="1"> </td></tr>\n' else: html_data += ''' <!-- <td class="user_action"> <a href="/users/skel/%s" title="%s"> <img src="/images/16x16/reapply-skel.png" alt="%s"/></a> </td> --> <td class="user_action"> <a href="/groups/delete/%s" title="%s"> <img src="/images/16x16/delete.png" alt="%s"/></a> </td> </tr> ''' % (name, _('This will rebuild his/her desktop from scratch, with defaults icons and so on.<br /><br />The user must be disconnected for the operation to be completely successfull.'), _('Reapply skel to group members.'), name, _('Definitely remove this group from system.'), _('Remove this group.')) return html_data data += '<tr><td class="group_class" colspan="8">%s</td></tr>\n%s' % (filter_name, ''.join(map(html_build_group, gkeys))) def print_totals(totals): output = "" for total in totals: if totals[total] != 0: output += ''' <tr class="list_total"> <td colspan="6" class="total_left">%s</td> <td colspan="6" class="total_right">%d</td> </tr> ''' % (_('number of <strong>%s</strong>:') % total, totals[total]) return output data += ''' <tr> <td colspan="6"> </td></tr> %s <tr class="list_total"> <td colspan="6" class="total_left"><strong>%s</strong></td> <td colspan="6" class="total_right">%d</td> </tr> | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
def main(uri, http_user, sort = "name", order = "asc"): start = time.time() users.reload() groups.reload() #reload(p) g = groups.groups users.Select(users.FILTER_STANDARD) tgroups = {} totals = {} title = "%s" % configuration.groups.names['_plural'] data = w.page_body_start(uri, http_user, ctxtnav, title) if order == "asc": reverseorder = "desc" else: reverseorder = "asc" data += '<table>\n <tr>\n' sortcols = ( ('', '', False), ("name", _("Name"), True), ("skel", _("Skeleton"), True), ("permissive", _("Perm."), True), ('members', "Members", False), ("resps", _("Responsibles"), False), ("guests", _("Guests"), False) ) for (column, name, can_sort) in sortcols: if can_sort: if column == sort: data += ''' <th><img src="/images/sort_%s.gif" alt="%s" />  <a href="/groups/list/%s/%s" title="%s">%s</a> </th>\n''' % (order, _('%s order') % order, column, reverseorder, _('Click to sort in reverse order.'), name) else: data += ' <th><a href="/groups/list/%s/asc" title="%s">%s</a></th>\n' % (column, _('Click to sort on this column.'), name) else: data += ' <th>%s</th>\n' % name data += ' </tr>\n' for (filter, filter_name) in ( (groups.FILTER_STANDARD, configuration.groups.names['_plural']), (groups.FILTER_PRIVILEGED, _("Privileges")) ): tgroups = {} ordered = {} totals[filter_name] = 0 groups.Select(filter) for gid in groups.filtered_groups: group = groups.groups[gid] name = group['name'] tgroups[gid] = { 'name' : name, 'skel' : group['skel'] + name, 'permissive': group['permissive'] } totals[filter_name] += 1 # index on the column choosen for sorting, and keep trace of the uid # to find account data back after ordering. ordered[hlstr.validate_name(tgroups[gid][sort])] = gid tgroups[gid]['members'] = [] for member in groups.groups[gid]['members']: if not users.is_system_login(member): tgroups[gid]['members'].append(users.users[users.login_to_uid(member)]) if not groups.is_system_gid(gid): for prefix in (configuration.groups.resp_prefix, configuration.groups.guest_prefix): tgroups[gid][prefix + 'members'] = [] for member in groups.groups[groups.name_to_gid(prefix + name)]['members']: if not users.is_system_login(member): tgroups[gid][prefix + 'members'].append(users.users[users.login_to_uid(member)]) gkeys = ordered.keys() gkeys.sort() if order == "desc": gkeys.reverse() def html_build_group(index, tgroups = tgroups ): gid = ordered[index] name = g[gid]['name'] html_data = ''' <tr class="userdata"> <td class="nopadding"><a href="/groups/view/%s" title="Visualiser le groupe, ses paramètres, ses membres, responsables et invités, en vue de les imprimer."><img src="/images/16x16/preview.png" alt="prévisualiser le groupe et ses données." /></a></td> <td class="group_name"> <a href="/groups/edit/%s" title="%s"><img src="/images/16x16/edit.png" alt="éditer les paramètres du groupe."/> %s</a> </td> <td class="right"> <a href="/groups/edit/%s">%s</a> </td> ''' % (name, name, g[gid]['description'], name, name, g[gid]['skel']) if groups.is_system_gid(gid): html_data += '<td> </td>' else: if g[gid]['permissive']: html_data += ''' <td class="user_action_center"> <a href="/groups/lock/%s" title="%s"> <img src="/images/16x16/unlocked.png" alt="%s"/></a> </td> ''' % (name, _('Shared group directory is currently <strong>permissive</strong>. Click to deactivate permissiveness.'), _('Group is currently permissive.')) else: html_data += ''' <td class="user_action_center"> <a href="/groups/unlock/%s" title="%s"> <img src="/images/16x16/locked.png" alt="%sø"/></a> </td> ''' % (name, _('Shared group directory is currently <strong>NOT</strong> permissive. Click ti activate permissiveness.'), _('Group is NOT permissive.')) for (keyname, text) in (('members', _('Current members')), ('rsp-members', _('Current responsibles')), ('gst-members', _('Current guests')) ): if tgroups[gid].has_key(keyname): accounts = {} uordered = {} for member in tgroups[gid][keyname]: uid = member['uid'] accounts[uid] = { 'login': member['login'], 'gecos': member['gecos'], 'gecos_sort': member['gecos'] + member['login'] } uordered[hlstr.validate_name(accounts[uid]['gecos_sort'], aggressive = True)] = uid memberkeys = uordered.keys() memberkeys.sort() mbdata = "<table><tr><th>%s</th><th>%s</th><th>%s</th></tr>\n" % (_('Full Name'), _('Identifier'), _('UID')) for member in memberkeys: uid = uordered[member] mbdata += '''<tr><td>%s</td><td>%s</td><td>%d</td></tr>\n''' % (accounts[uid]['gecos'], accounts[uid]['login'], uid) mbdata += '</table>' nb = len(tgroups[gid][keyname]) if nb == 0: html_data += '''<td class="right faded">%s</td>\n''' % _('none') else: html_data += '''<td class="right"><a class="nounder" title="<h4>%s</h4><br />%s"><strong>%d</strong> <img src="/images/16x16/details-light.png" alt="%s" /></a></td>\n''' % (text, mbdata, nb, _('See %s of group %s.') % (text, name)) else: html_data += '''<td> </td>\n''' if groups.is_system_gid(gid): html_data += '<td colspan="1"> </td></tr>\n' else: html_data += ''' <!-- <td class="user_action"> <a href="/users/skel/%s" title="%s"> <img src="/images/16x16/reapply-skel.png" alt="%s"/></a> </td> --> <td class="user_action"> <a href="/groups/delete/%s" title="%s"> <img src="/images/16x16/delete.png" alt="%s"/></a> </td> </tr> ''' % (name, _('This will rebuild his/her desktop from scratch, with defaults icons and so on.<br /><br />The user must be disconnected for the operation to be completely successfull.'), _('Reapply skel to group members.'), name, _('Definitely remove this group from system.'), _('Remove this group.')) return html_data data += '<tr><td class="group_class" colspan="8">%s</td></tr>\n%s' % (filter_name, ''.join(map(html_build_group, gkeys))) def print_totals(totals): output = "" for total in totals: if totals[total] != 0: output += ''' <tr class="list_total"> <td colspan="6" class="total_left">%s</td> <td colspan="6" class="total_right">%d</td> </tr> ''' % (_('number of <strong>%s</strong>:') % total, totals[total]) return output data += ''' <tr> <td colspan="6"> </td></tr> %s <tr class="list_total"> <td colspan="6" class="total_left"><strong>%s</strong></td> <td colspan="6" class="total_right">%d</td> </tr> | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
name = group['name'] | name = group['name'] | def main(uri, http_user, sort = "name", order = "asc"): start = time.time() users.reload() groups.reload() #reload(p) g = groups.groups users.Select(users.FILTER_STANDARD) tgroups = {} totals = {} title = "%s" % configuration.groups.names['_plural'] data = w.page_body_start(uri, http_user, ctxtnav, title) if order == "asc": reverseorder = "desc" else: reverseorder = "asc" data += '<table>\n <tr>\n' sortcols = ( ('', '', False), ("name", _("Name"), True), ("skel", _("Skeleton"), True), ("permissive", _("Perm."), True), ('members', "Members", False), ("resps", _("Responsibles"), False), ("guests", _("Guests"), False) ) for (column, name, can_sort) in sortcols: if can_sort: if column == sort: data += ''' <th><img src="/images/sort_%s.gif" alt="%s" />  <a href="/groups/list/%s/%s" title="%s">%s</a> </th>\n''' % (order, _('%s order') % order, column, reverseorder, _('Click to sort in reverse order.'), name) else: data += ' <th><a href="/groups/list/%s/asc" title="%s">%s</a></th>\n' % (column, _('Click to sort on this column.'), name) else: data += ' <th>%s</th>\n' % name data += ' </tr>\n' for (filter, filter_name) in ( (groups.FILTER_STANDARD, configuration.groups.names['_plural']), (groups.FILTER_PRIVILEGED, _("Privileges")) ): tgroups = {} ordered = {} totals[filter_name] = 0 groups.Select(filter) for gid in groups.filtered_groups: group = groups.groups[gid] name = group['name'] tgroups[gid] = { 'name' : name, 'skel' : group['skel'] + name, 'permissive': group['permissive'] } totals[filter_name] += 1 # index on the column choosen for sorting, and keep trace of the uid # to find account data back after ordering. ordered[hlstr.validate_name(tgroups[gid][sort])] = gid tgroups[gid]['members'] = [] for member in groups.groups[gid]['members']: if not users.is_system_login(member): tgroups[gid]['members'].append(users.users[users.login_to_uid(member)]) if not groups.is_system_gid(gid): for prefix in (configuration.groups.resp_prefix, configuration.groups.guest_prefix): tgroups[gid][prefix + 'members'] = [] for member in groups.groups[groups.name_to_gid(prefix + name)]['members']: if not users.is_system_login(member): tgroups[gid][prefix + 'members'].append(users.users[users.login_to_uid(member)]) gkeys = ordered.keys() gkeys.sort() if order == "desc": gkeys.reverse() def html_build_group(index, tgroups = tgroups ): gid = ordered[index] name = g[gid]['name'] html_data = ''' <tr class="userdata"> <td class="nopadding"><a href="/groups/view/%s" title="Visualiser le groupe, ses paramètres, ses membres, responsables et invités, en vue de les imprimer."><img src="/images/16x16/preview.png" alt="prévisualiser le groupe et ses données." /></a></td> <td class="group_name"> <a href="/groups/edit/%s" title="%s"><img src="/images/16x16/edit.png" alt="éditer les paramètres du groupe."/> %s</a> </td> <td class="right"> <a href="/groups/edit/%s">%s</a> </td> ''' % (name, name, g[gid]['description'], name, name, g[gid]['skel']) if groups.is_system_gid(gid): html_data += '<td> </td>' else: if g[gid]['permissive']: html_data += ''' <td class="user_action_center"> <a href="/groups/lock/%s" title="%s"> <img src="/images/16x16/unlocked.png" alt="%s"/></a> </td> ''' % (name, _('Shared group directory is currently <strong>permissive</strong>. Click to deactivate permissiveness.'), _('Group is currently permissive.')) else: html_data += ''' <td class="user_action_center"> <a href="/groups/unlock/%s" title="%s"> <img src="/images/16x16/locked.png" alt="%sø"/></a> </td> ''' % (name, _('Shared group directory is currently <strong>NOT</strong> permissive. Click ti activate permissiveness.'), _('Group is NOT permissive.')) for (keyname, text) in (('members', _('Current members')), ('rsp-members', _('Current responsibles')), ('gst-members', _('Current guests')) ): if tgroups[gid].has_key(keyname): accounts = {} uordered = {} for member in tgroups[gid][keyname]: uid = member['uid'] accounts[uid] = { 'login': member['login'], 'gecos': member['gecos'], 'gecos_sort': member['gecos'] + member['login'] } uordered[hlstr.validate_name(accounts[uid]['gecos_sort'], aggressive = True)] = uid memberkeys = uordered.keys() memberkeys.sort() mbdata = "<table><tr><th>%s</th><th>%s</th><th>%s</th></tr>\n" % (_('Full Name'), _('Identifier'), _('UID')) for member in memberkeys: uid = uordered[member] mbdata += '''<tr><td>%s</td><td>%s</td><td>%d</td></tr>\n''' % (accounts[uid]['gecos'], accounts[uid]['login'], uid) mbdata += '</table>' nb = len(tgroups[gid][keyname]) if nb == 0: html_data += '''<td class="right faded">%s</td>\n''' % _('none') else: html_data += '''<td class="right"><a class="nounder" title="<h4>%s</h4><br />%s"><strong>%d</strong> <img src="/images/16x16/details-light.png" alt="%s" /></a></td>\n''' % (text, mbdata, nb, _('See %s of group %s.') % (text, name)) else: html_data += '''<td> </td>\n''' if groups.is_system_gid(gid): html_data += '<td colspan="1"> </td></tr>\n' else: html_data += ''' <!-- <td class="user_action"> <a href="/users/skel/%s" title="%s"> <img src="/images/16x16/reapply-skel.png" alt="%s"/></a> </td> --> <td class="user_action"> <a href="/groups/delete/%s" title="%s"> <img src="/images/16x16/delete.png" alt="%s"/></a> </td> </tr> ''' % (name, _('This will rebuild his/her desktop from scratch, with defaults icons and so on.<br /><br />The user must be disconnected for the operation to be completely successfull.'), _('Reapply skel to group members.'), name, _('Definitely remove this group from system.'), _('Remove this group.')) return html_data data += '<tr><td class="group_class" colspan="8">%s</td></tr>\n%s' % (filter_name, ''.join(map(html_build_group, gkeys))) def print_totals(totals): output = "" for total in totals: if totals[total] != 0: output += ''' <tr class="list_total"> <td colspan="6" class="total_left">%s</td> <td colspan="6" class="total_right">%d</td> </tr> ''' % (_('number of <strong>%s</strong>:') % total, totals[total]) return output data += ''' <tr> <td colspan="6"> </td></tr> %s <tr class="list_total"> <td colspan="6" class="total_left"><strong>%s</strong></td> <td colspan="6" class="total_right">%d</td> </tr> | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
tgroups[gid]['members'].append(users.users[users.login_to_uid(member)]) | tgroups[gid]['members'].append(users.users[users.login_to_uid(member)]) | def main(uri, http_user, sort = "name", order = "asc"): start = time.time() users.reload() groups.reload() #reload(p) g = groups.groups users.Select(users.FILTER_STANDARD) tgroups = {} totals = {} title = "%s" % configuration.groups.names['_plural'] data = w.page_body_start(uri, http_user, ctxtnav, title) if order == "asc": reverseorder = "desc" else: reverseorder = "asc" data += '<table>\n <tr>\n' sortcols = ( ('', '', False), ("name", _("Name"), True), ("skel", _("Skeleton"), True), ("permissive", _("Perm."), True), ('members', "Members", False), ("resps", _("Responsibles"), False), ("guests", _("Guests"), False) ) for (column, name, can_sort) in sortcols: if can_sort: if column == sort: data += ''' <th><img src="/images/sort_%s.gif" alt="%s" />  <a href="/groups/list/%s/%s" title="%s">%s</a> </th>\n''' % (order, _('%s order') % order, column, reverseorder, _('Click to sort in reverse order.'), name) else: data += ' <th><a href="/groups/list/%s/asc" title="%s">%s</a></th>\n' % (column, _('Click to sort on this column.'), name) else: data += ' <th>%s</th>\n' % name data += ' </tr>\n' for (filter, filter_name) in ( (groups.FILTER_STANDARD, configuration.groups.names['_plural']), (groups.FILTER_PRIVILEGED, _("Privileges")) ): tgroups = {} ordered = {} totals[filter_name] = 0 groups.Select(filter) for gid in groups.filtered_groups: group = groups.groups[gid] name = group['name'] tgroups[gid] = { 'name' : name, 'skel' : group['skel'] + name, 'permissive': group['permissive'] } totals[filter_name] += 1 # index on the column choosen for sorting, and keep trace of the uid # to find account data back after ordering. ordered[hlstr.validate_name(tgroups[gid][sort])] = gid tgroups[gid]['members'] = [] for member in groups.groups[gid]['members']: if not users.is_system_login(member): tgroups[gid]['members'].append(users.users[users.login_to_uid(member)]) if not groups.is_system_gid(gid): for prefix in (configuration.groups.resp_prefix, configuration.groups.guest_prefix): tgroups[gid][prefix + 'members'] = [] for member in groups.groups[groups.name_to_gid(prefix + name)]['members']: if not users.is_system_login(member): tgroups[gid][prefix + 'members'].append(users.users[users.login_to_uid(member)]) gkeys = ordered.keys() gkeys.sort() if order == "desc": gkeys.reverse() def html_build_group(index, tgroups = tgroups ): gid = ordered[index] name = g[gid]['name'] html_data = ''' <tr class="userdata"> <td class="nopadding"><a href="/groups/view/%s" title="Visualiser le groupe, ses paramètres, ses membres, responsables et invités, en vue de les imprimer."><img src="/images/16x16/preview.png" alt="prévisualiser le groupe et ses données." /></a></td> <td class="group_name"> <a href="/groups/edit/%s" title="%s"><img src="/images/16x16/edit.png" alt="éditer les paramètres du groupe."/> %s</a> </td> <td class="right"> <a href="/groups/edit/%s">%s</a> </td> ''' % (name, name, g[gid]['description'], name, name, g[gid]['skel']) if groups.is_system_gid(gid): html_data += '<td> </td>' else: if g[gid]['permissive']: html_data += ''' <td class="user_action_center"> <a href="/groups/lock/%s" title="%s"> <img src="/images/16x16/unlocked.png" alt="%s"/></a> </td> ''' % (name, _('Shared group directory is currently <strong>permissive</strong>. Click to deactivate permissiveness.'), _('Group is currently permissive.')) else: html_data += ''' <td class="user_action_center"> <a href="/groups/unlock/%s" title="%s"> <img src="/images/16x16/locked.png" alt="%sø"/></a> </td> ''' % (name, _('Shared group directory is currently <strong>NOT</strong> permissive. Click ti activate permissiveness.'), _('Group is NOT permissive.')) for (keyname, text) in (('members', _('Current members')), ('rsp-members', _('Current responsibles')), ('gst-members', _('Current guests')) ): if tgroups[gid].has_key(keyname): accounts = {} uordered = {} for member in tgroups[gid][keyname]: uid = member['uid'] accounts[uid] = { 'login': member['login'], 'gecos': member['gecos'], 'gecos_sort': member['gecos'] + member['login'] } uordered[hlstr.validate_name(accounts[uid]['gecos_sort'], aggressive = True)] = uid memberkeys = uordered.keys() memberkeys.sort() mbdata = "<table><tr><th>%s</th><th>%s</th><th>%s</th></tr>\n" % (_('Full Name'), _('Identifier'), _('UID')) for member in memberkeys: uid = uordered[member] mbdata += '''<tr><td>%s</td><td>%s</td><td>%d</td></tr>\n''' % (accounts[uid]['gecos'], accounts[uid]['login'], uid) mbdata += '</table>' nb = len(tgroups[gid][keyname]) if nb == 0: html_data += '''<td class="right faded">%s</td>\n''' % _('none') else: html_data += '''<td class="right"><a class="nounder" title="<h4>%s</h4><br />%s"><strong>%d</strong> <img src="/images/16x16/details-light.png" alt="%s" /></a></td>\n''' % (text, mbdata, nb, _('See %s of group %s.') % (text, name)) else: html_data += '''<td> </td>\n''' if groups.is_system_gid(gid): html_data += '<td colspan="1"> </td></tr>\n' else: html_data += ''' <!-- <td class="user_action"> <a href="/users/skel/%s" title="%s"> <img src="/images/16x16/reapply-skel.png" alt="%s"/></a> </td> --> <td class="user_action"> <a href="/groups/delete/%s" title="%s"> <img src="/images/16x16/delete.png" alt="%s"/></a> </td> </tr> ''' % (name, _('This will rebuild his/her desktop from scratch, with defaults icons and so on.<br /><br />The user must be disconnected for the operation to be completely successfull.'), _('Reapply skel to group members.'), name, _('Definitely remove this group from system.'), _('Remove this group.')) return html_data data += '<tr><td class="group_class" colspan="8">%s</td></tr>\n%s' % (filter_name, ''.join(map(html_build_group, gkeys))) def print_totals(totals): output = "" for total in totals: if totals[total] != 0: output += ''' <tr class="list_total"> <td colspan="6" class="total_left">%s</td> <td colspan="6" class="total_right">%d</td> </tr> ''' % (_('number of <strong>%s</strong>:') % total, totals[total]) return output data += ''' <tr> <td colspan="6"> </td></tr> %s <tr class="list_total"> <td colspan="6" class="total_left"><strong>%s</strong></td> <td colspan="6" class="total_right">%d</td> </tr> | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
def html_build_group(index, tgroups = tgroups ): gid = ordered[index] name = g[gid]['name'] html_data = ''' | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
html_data += '''<td class="right"><a class="nounder" title="<h4>%s</h4><br />%s"><strong>%d</strong>& | html_data += '''<td class="right"><a class="nounder" title="<h4>%s</h4><br />%s"><strong>%d</strong>& | def html_build_group(index, tgroups = tgroups ): gid = ordered[index] name = g[gid]['name'] html_data = ''' | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
def html_build_group(index, tgroups = tgroups ): gid = ordered[index] name = g[gid]['name'] html_data = ''' | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
def html_build_group(index, tgroups = tgroups ): gid = ordered[index] name = g[gid]['name'] html_data = ''' | e74a9415e90d5a3af83e10abed2f1876ae4e528a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/e74a9415e90d5a3af83e10abed2f1876ae4e528a/groups.py |
||
ltrace('configuration', 'CleanUp().') if os.path.exists(self.tmp_dir): | ltrace('configuration', '> CleanUp()') try: | def CleanUp(self): """This is a sort of destructor. Clean-up before being deleted...""" | a3c09c9f6b06e9e8c63cf20dff6cfc3cbebc3b39 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/a3c09c9f6b06e9e8c63cf20dff6cfc3cbebc3b39/configuration.py |
if uid > self.configuration.users.system_uid_min \ and uid < self.configuration.users.system_uid_max: | if uid >= self.configuration.users.system_uid_min \ and uid <= self.configuration.users.system_uid_max: | def check_uid(uid, minimal=minimal, batch=batch, auto_answer=auto_answer): | 0aa53b47bbec83b65a54c956f781f7a391699215 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/0aa53b47bbec83b65a54c956f781f7a391699215/users.py |
'''GRP-ACL-user''', | '''GRP-ACL-user,utest_267''', | def clean_system(): """ Remove all stuff to make the system clean, testsuite-wise.""" test_message('''cleaning system from previous runs.''') # delete them first in case of a previous failed testsuite run. # don't check exit codes or such, this will be done later. for argument in ( ['user', '''toto,tutu,tata,titi,test,utilisager.normal,''' \ '''test.responsibilly,utilicateur.accentue,user_test,''' \ '''GRP-ACL-user''', '--no-archive'], ['profile', '--group=utilisagers', '--del-users', '--no-archive'], ['profile', '--group=responsibilisateurs', '--del-users', '--no-archive'], ['group', '''test_users_A,test_users_B,groupeA,B-Group_Test,''' \ '''groupe_a_skel,ACL_tests,MOD_tests,SYSTEM-test,SKEL-tests,''' \ '''ARCHIVES-test,group_test,GRP-ACL-test'''], ): execute(DEL + argument) execute([ 'sudo', 'rm', '-rf', '%s/*' % configuration.home_backup_dir, '%s/*' % configuration.home_archive_dir ]) execute(ADD + ['group', '--system', 'acl,admins,remotessh,licorn-wmi']) test_message('''system cleaned from previous testsuite runs.''') | c7a24ffc685eea186397e4d74c31926a514dc16f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/c7a24ffc685eea186397e4d74c31926a514dc16f/core.py |
'''ARCHIVES-test,group_test,GRP-ACL-test'''], | '''ARCHIVES-test,group_test,GRP-ACL-test,gtest_267'''], | def clean_system(): """ Remove all stuff to make the system clean, testsuite-wise.""" test_message('''cleaning system from previous runs.''') # delete them first in case of a previous failed testsuite run. # don't check exit codes or such, this will be done later. for argument in ( ['user', '''toto,tutu,tata,titi,test,utilisager.normal,''' \ '''test.responsibilly,utilicateur.accentue,user_test,''' \ '''GRP-ACL-user''', '--no-archive'], ['profile', '--group=utilisagers', '--del-users', '--no-archive'], ['profile', '--group=responsibilisateurs', '--del-users', '--no-archive'], ['group', '''test_users_A,test_users_B,groupeA,B-Group_Test,''' \ '''groupe_a_skel,ACL_tests,MOD_tests,SYSTEM-test,SKEL-tests,''' \ '''ARCHIVES-test,group_test,GRP-ACL-test'''], ): execute(DEL + argument) execute([ 'sudo', 'rm', '-rf', '%s/*' % configuration.home_backup_dir, '%s/*' % configuration.home_archive_dir ]) execute(ADD + ['group', '--system', 'acl,admins,remotessh,licorn-wmi']) test_message('''system cleaned from previous testsuite runs.''') | c7a24ffc685eea186397e4d74c31926a514dc16f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/c7a24ffc685eea186397e4d74c31926a514dc16f/core.py |
users.LockAccount(uid, opts.lock) | users.LockAccount(uid=uid, lock=opts.lock) | def mod_user(opts, args): """ Modify a POSIX user account (Samba / LDAP included). """ configuration = LicornConfiguration() users = UsersController(configuration) uids_to_mod = cli_select(users, 'user', args, [ (opts.login, users.login_to_uid), (opts.uid, users.confirm_uid) ]) ltrace('mod', '> mod_user(%s)' % uids_to_mod) something_done = False for uid in uids_to_mod: if opts.newgecos is not None: something_done = True users.ChangeUserGecos(uid=uid, gecos=unicode(opts.newgecos)) if opts.newshell is not None: something_done = True users.ChangeUserShell(uid=uid, shell=opts.newshell) if opts.newpassword is not None: something_done = True users.ChangeUserPassword(uid=uid, password=opts.newpassword) if opts.auto_passwd is not None: something_done = True users.ChangeUserPassword(uid=uid, password=hlstr.generate_password(opts.passwd_size), display=True) if opts.lock is not None: something_done = True users.LockAccount(uid, opts.lock) if opts.groups_to_add: something_done = True for g in opts.groups_to_add.split(','): if g != '': try: groups = GroupsController(configuration, users) groups.AddUsersInGroup(name=g, users_to_add=[ uid ]) except exceptions.LicornRuntimeException, e: logging.warning('''Unable to add user %s in group ''' '''%s (was: %s).''' % ( styles.stylize(styles.ST_LOGIN, UsersController.uid_to_login(uid)), styles.stylize(styles.ST_NAME, g), str(e))) except exceptions.LicornException, e: raise exceptions.LicornRuntimeError( '''Unable to add user %s in group %s (was: %s).''' % (styles.stylize(styles.ST_LOGIN, UsersController.uid_to_login(uid)), styles.stylize(styles.ST_NAME, g), str(e))) if opts.groups_to_del: something_done = True for g in opts.groups_to_del.split(','): if g != '': try: groups = GroupsController(configuration, users) groups.DeleteUsersFromGroup(name=g, users_to_del=[ uid ]) except exceptions.LicornRuntimeException, e: logging.warning('''Unable to remove user %s from ''' '''group %s (was: %s).''' % ( styles.stylize(styles.ST_LOGIN, opts.login), styles.stylize(styles.ST_NAME, g), str(e))) except exceptions.LicornException, e: raise exceptions.LicornRuntimeError( '''Unable to remove user %s from ''' '''group %s (was: %s).''' % ( styles.stylize(styles.ST_LOGIN, opts.login), styles.stylize(styles.ST_NAME, g), str(e))) if opts.apply_skel is not None: something_done = True users.ApplyUserSkel(opts.login, opts.apply_skel) if not something_done: raise exceptions.BadArgumentError('''What do you want to modify ''' '''about user(s) ? Use --help to know !''') | 1c17b2eae99f3354c51dc73cf67b2fa1f64feba4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/1c17b2eae99f3354c51dc73cf67b2fa1f64feba4/mod.py |
def chk_acls_cmds(group, subdir=None): return [ 'sudo', 'getfacl', '-R', '%s/%s/%s%s' % ( configuration.defaults.home_base_path, configuration.groups.names['plural'], group, '/%s' % subdir if subdir else '') ] | d77e66f69d30b54dc1b03a86fcb4384c4894768d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/d77e66f69d30b54dc1b03a86fcb4384c4894768d/core.py |
||
) | ).Run() | def chk_acls_cmds(group, subdir=None): return [ 'sudo', 'getfacl', '-R', '%s/%s/%s%s' % ( configuration.defaults.home_base_path, configuration.groups.names['plural'], group, '/%s' % subdir if subdir else '') ] | d77e66f69d30b54dc1b03a86fcb4384c4894768d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7650/d77e66f69d30b54dc1b03a86fcb4384c4894768d/core.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.