app-admin/mmc-agent: Update kerberos Patch
git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/mds@708 6952d904-891a-0410-993b-d76249ca496b
This commit is contained in:
parent
e4fff986bc
commit
829af809c9
@ -2,6 +2,11 @@
|
|||||||
# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
|
# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
|
||||||
# $Header: $
|
# $Header: $
|
||||||
|
|
||||||
|
21 Jan 2009; Mario Fetka <mario.fetka@gmail.com>
|
||||||
|
files/mmc-agent-2.3.1-kerberos-1.patch,
|
||||||
|
+files/mmc-agent-2.3.2-printing-1.patch:
|
||||||
|
Update kerberos Patch
|
||||||
|
|
||||||
11 Jan 2009; Mario Fetka <mario.fetka@gmail.com> +mmc-agent-2.3.2.ebuild:
|
11 Jan 2009; Mario Fetka <mario.fetka@gmail.com> +mmc-agent-2.3.2.ebuild:
|
||||||
Bump
|
Bump
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
AUX mmc-agent-2.3.1-kerberos-1.patch 14230 RMD160 236a276fe5bae2a6927af8b9d619ad83d3c41b38 SHA1 8475086422569d922d114c22285b6e47b02fb18d SHA256 c1913d1e8ca4653479d9920ce9a6f238f503b25e21c03213c38e81178e3b1d0d
|
AUX mmc-agent-2.3.1-kerberos-1.patch 18639 RMD160 a0c4ea35784b9f2adbba9986e3fc0e81a68f29bc SHA1 0d388bd015e9ede8d6cca7babfbff920984373ed SHA256 aeafd3eb65d7168395ddff1fd7bcd5d8a1c5b63b02b46e22a78df543a3a826ea
|
||||||
AUX mmc-agent-2.3.2-printing-1.patch 33371 RMD160 f7064ec4dfc2e923c522f01190ca5d4f7d493d43 SHA1 ca9219b982e210bd92c85db8f982e1a3c6b9d48b SHA256 97dc50bb286361286e5451d2e85ea9b9d8609a2f92c3f3ca3836e9bcbcd1c931
|
AUX mmc-agent-2.3.2-printing-1.patch 33371 RMD160 f7064ec4dfc2e923c522f01190ca5d4f7d493d43 SHA1 ca9219b982e210bd92c85db8f982e1a3c6b9d48b SHA256 97dc50bb286361286e5451d2e85ea9b9d8609a2f92c3f3ca3836e9bcbcd1c931
|
||||||
AUX mmc-agent.initd 438 RMD160 d7dc64366782ab0d6fe4347d6a169b88a4e03a49 SHA1 e4ae8808678161237703bbb63b144899c9a544c9 SHA256 922d0bacad3eda749f8807e3ae5c183f636fa93e0d41d7079e570c58ebccb879
|
AUX mmc-agent.initd 438 RMD160 d7dc64366782ab0d6fe4347d6a169b88a4e03a49 SHA1 e4ae8808678161237703bbb63b144899c9a544c9 SHA256 922d0bacad3eda749f8807e3ae5c183f636fa93e0d41d7079e570c58ebccb879
|
||||||
DIST mmc-agent-2.3.1.tar.gz 111217 RMD160 7e75cbf9637a50214f7d2f1eee5049f7809d29aa SHA1 35f468ad4eb77ca4117695eb2b6ea83b38a01d46 SHA256 39e594a36f7cde73e6dfcc3845841137c0fe016c82c6343838fb8879931c757b
|
DIST mmc-agent-2.3.1.tar.gz 111217 RMD160 7e75cbf9637a50214f7d2f1eee5049f7809d29aa SHA1 35f468ad4eb77ca4117695eb2b6ea83b38a01d46 SHA256 39e594a36f7cde73e6dfcc3845841137c0fe016c82c6343838fb8879931c757b
|
||||||
DIST mmc-agent-2.3.2.tar.gz 120949 RMD160 871b3b7766d69019de392e42ebf25a216d217c71 SHA1 1e7c634243c00c6b214f24c3467315d31a444215 SHA256 0ac8ff97818c58008cadb3c6b08dba39e42b078fea9d392fda649e036eabaea2
|
DIST mmc-agent-2.3.2.tar.gz 120949 RMD160 871b3b7766d69019de392e42ebf25a216d217c71 SHA1 1e7c634243c00c6b214f24c3467315d31a444215 SHA256 0ac8ff97818c58008cadb3c6b08dba39e42b078fea9d392fda649e036eabaea2
|
||||||
EBUILD mmc-agent-2.3.1.ebuild 1250 RMD160 0230a124ace55353571f7b1b201664bd45405999 SHA1 af139ef81aee700b236962b6622e9e8f2a8986cf SHA256 da0e889c925d0ce8442081c4f3155a4f82dce17b152a54be798ee7e25e4917a1
|
EBUILD mmc-agent-2.3.1.ebuild 1250 RMD160 0230a124ace55353571f7b1b201664bd45405999 SHA1 af139ef81aee700b236962b6622e9e8f2a8986cf SHA256 da0e889c925d0ce8442081c4f3155a4f82dce17b152a54be798ee7e25e4917a1
|
||||||
EBUILD mmc-agent-2.3.2.ebuild 1359 RMD160 9828113e282019037c1c189d877f3af743f43a0a SHA1 7c105971764320d297dc85350b04dcdca6fe5dda SHA256 e83cdb0c79ca797b180e01a3eb84117e516574bf8665dcba234ebc3d2195e139
|
EBUILD mmc-agent-2.3.2.ebuild 1359 RMD160 9828113e282019037c1c189d877f3af743f43a0a SHA1 7c105971764320d297dc85350b04dcdca6fe5dda SHA256 e83cdb0c79ca797b180e01a3eb84117e516574bf8665dcba234ebc3d2195e139
|
||||||
MISC ChangeLog 488 RMD160 9342f9c6d57681478ccf6e653551566aae20ceb8 SHA1 c96bec68b8d199af765a40076f49854a5ab001c6 SHA256 0c9726222878d99c78eaf10dec89c3a1e395e0d83fe276424cf3eb6895240c06
|
MISC ChangeLog 649 RMD160 e55c71706c2b3d361e3a00793f8ca0f4aa70a892 SHA1 d1d6ff2ea966876c67f681c071f83b9982847966 SHA256 f1c59f5f7845484be9200199e2503bd2013a22161a8aaad8ee308d205aff6dc5
|
||||||
MISC metadata.xml 170 RMD160 645927a396fdc21cdeb089fe42c5397332420ea6 SHA1 ac7f48a14fec325926f9ce1be8fbf1f311b4f2e4 SHA256 d797a2ec6f9dc516c9f9c1a758ee87ad3e8c43101b5dc76c2f872d5bd4639b42
|
MISC metadata.xml 170 RMD160 645927a396fdc21cdeb089fe42c5397332420ea6 SHA1 ac7f48a14fec325926f9ce1be8fbf1f311b4f2e4 SHA256 d797a2ec6f9dc516c9f9c1a758ee87ad3e8c43101b5dc76c2f872d5bd4639b42
|
||||||
|
@ -294,3 +294,143 @@ diff -Naur mmc-agent-2.3.1.orig/setup.py mmc-agent-2.3.1/setup.py
|
|||||||
- packages = ["mmc", "mmc.support", "mmc.plugins", "mmc.plugins.base", "mmc.plugins.samba", "mmc.plugins.proxy", "mmc.plugins.mail", "mmc.plugins.network"],
|
- packages = ["mmc", "mmc.support", "mmc.plugins", "mmc.plugins.base", "mmc.plugins.samba", "mmc.plugins.proxy", "mmc.plugins.mail", "mmc.plugins.network"],
|
||||||
+ packages = ["mmc", "mmc.support", "mmc.plugins", "mmc.plugins.base", "mmc.plugins.samba", "mmc.plugins.proxy", "mmc.plugins.mail", "mmc.plugins.network", "mmc.plugins.kerberos"],
|
+ packages = ["mmc", "mmc.support", "mmc.plugins", "mmc.plugins.base", "mmc.plugins.samba", "mmc.plugins.proxy", "mmc.plugins.mail", "mmc.plugins.network", "mmc.plugins.kerberos"],
|
||||||
)
|
)
|
||||||
|
diff -Naur mmc-agent-2.3.1.orig/contrib/ldap/krb5-kdc.schema mmc-agent-2.3.1/contrib/ldap/krb5-kdc.schema
|
||||||
|
--- mmc-agent-2.3.1.orig/contrib/ldap/krb5-kdc.schema
|
||||||
|
+++ mmc-agent-2.3.1/contrib/ldap/krb5-kdc.schema
|
||||||
|
@@ -0,0 +1,136 @@
|
||||||
|
+# $Id: krb5-kdc.schema,v 1.1 2004-03-22 17:25:05 quanah Exp $
|
||||||
|
+# Definitions for a Kerberos V KDC schema
|
||||||
|
+
|
||||||
|
+# OID Base is iso(1) org(3) dod(6) internet(1) private(4) enterprise(1) padl(5322) kdcSchema(10)
|
||||||
|
+#
|
||||||
|
+# Syntaxes are under 1.3.6.1.4.1.5322.10.0
|
||||||
|
+# Attributes types are under 1.3.6.1.4.1.5322.10.1
|
||||||
|
+# Object classes are under 1.3.6.1.4.1.5322.10.2
|
||||||
|
+
|
||||||
|
+# Syntax definitions
|
||||||
|
+
|
||||||
|
+#krb5KDCFlagsSyntax SYNTAX ::= {
|
||||||
|
+# WITH SYNTAX INTEGER
|
||||||
|
+#-- initial(0), -- require as-req
|
||||||
|
+#-- forwardable(1), -- may issue forwardable
|
||||||
|
+#-- proxiable(2), -- may issue proxiable
|
||||||
|
+#-- renewable(3), -- may issue renewable
|
||||||
|
+#-- postdate(4), -- may issue postdatable
|
||||||
|
+#-- server(5), -- may be server
|
||||||
|
+#-- client(6), -- may be client
|
||||||
|
+#-- invalid(7), -- entry is invalid
|
||||||
|
+#-- require-preauth(8), -- must use preauth
|
||||||
|
+#-- change-pw(9), -- change password service
|
||||||
|
+#-- require-hwauth(10), -- must use hwauth
|
||||||
|
+#-- ok-as-delegate(11), -- as in TicketFlags
|
||||||
|
+#-- user-to-user(12), -- may use user-to-user auth
|
||||||
|
+#-- immutable(13) -- may not be deleted
|
||||||
|
+# ID { 1.3.6.1.4.1.5322.10.0.1 }
|
||||||
|
+#}
|
||||||
|
+
|
||||||
|
+#krb5PrincipalNameSyntax SYNTAX ::= {
|
||||||
|
+# WITH SYNTAX OCTET STRING
|
||||||
|
+#-- String representations of distinguished names as per RFC1510
|
||||||
|
+# ID { 1.3.6.1.4.1.5322.10.0.2 }
|
||||||
|
+#}
|
||||||
|
+
|
||||||
|
+# Attribute type definitions
|
||||||
|
+
|
||||||
|
+attributetype ( 1.3.6.1.4.1.5322.10.1.1
|
||||||
|
+ NAME 'krb5PrincipalName'
|
||||||
|
+ DESC 'The unparsed Kerberos principal name'
|
||||||
|
+ EQUALITY caseExactIA5Match
|
||||||
|
+ SINGLE-VALUE
|
||||||
|
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
|
||||||
|
+
|
||||||
|
+attributetype ( 1.3.6.1.4.1.5322.10.1.2
|
||||||
|
+ NAME 'krb5KeyVersionNumber'
|
||||||
|
+ EQUALITY integerMatch
|
||||||
|
+ SINGLE-VALUE
|
||||||
|
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
|
||||||
|
+
|
||||||
|
+attributetype ( 1.3.6.1.4.1.5322.10.1.3
|
||||||
|
+ NAME 'krb5MaxLife'
|
||||||
|
+ EQUALITY integerMatch
|
||||||
|
+ SINGLE-VALUE
|
||||||
|
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
|
||||||
|
+
|
||||||
|
+attributetype ( 1.3.6.1.4.1.5322.10.1.4
|
||||||
|
+ NAME 'krb5MaxRenew'
|
||||||
|
+ EQUALITY integerMatch
|
||||||
|
+ SINGLE-VALUE
|
||||||
|
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
|
||||||
|
+
|
||||||
|
+attributetype ( 1.3.6.1.4.1.5322.10.1.5
|
||||||
|
+ NAME 'krb5KDCFlags'
|
||||||
|
+ EQUALITY integerMatch
|
||||||
|
+ SINGLE-VALUE
|
||||||
|
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
|
||||||
|
+
|
||||||
|
+attributetype ( 1.3.6.1.4.1.5322.10.1.6
|
||||||
|
+ NAME 'krb5EncryptionType'
|
||||||
|
+ EQUALITY integerMatch
|
||||||
|
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
|
||||||
|
+
|
||||||
|
+attributetype ( 1.3.6.1.4.1.5322.10.1.7
|
||||||
|
+ NAME 'krb5ValidStart'
|
||||||
|
+ EQUALITY generalizedTimeMatch
|
||||||
|
+ ORDERING generalizedTimeOrderingMatch
|
||||||
|
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.24
|
||||||
|
+ SINGLE-VALUE )
|
||||||
|
+
|
||||||
|
+attributetype ( 1.3.6.1.4.1.5322.10.1.8
|
||||||
|
+ NAME 'krb5ValidEnd'
|
||||||
|
+ EQUALITY generalizedTimeMatch
|
||||||
|
+ ORDERING generalizedTimeOrderingMatch
|
||||||
|
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.24
|
||||||
|
+ SINGLE-VALUE )
|
||||||
|
+
|
||||||
|
+attributetype ( 1.3.6.1.4.1.5322.10.1.9
|
||||||
|
+ NAME 'krb5PasswordEnd'
|
||||||
|
+ EQUALITY generalizedTimeMatch
|
||||||
|
+ ORDERING generalizedTimeOrderingMatch
|
||||||
|
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.24
|
||||||
|
+ SINGLE-VALUE )
|
||||||
|
+
|
||||||
|
+# this is temporary; keys will eventually
|
||||||
|
+# be child entries or compound attributes.
|
||||||
|
+attributetype ( 1.3.6.1.4.1.5322.10.1.10
|
||||||
|
+ NAME 'krb5Key'
|
||||||
|
+ DESC 'Encoded ASN1 Key as an octet string'
|
||||||
|
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 )
|
||||||
|
+
|
||||||
|
+attributetype ( 1.3.6.1.4.1.5322.10.1.11
|
||||||
|
+ NAME 'krb5PrincipalRealm'
|
||||||
|
+ DESC 'Distinguished name of krb5Realm entry'
|
||||||
|
+ SUP distinguishedName )
|
||||||
|
+
|
||||||
|
+attributetype ( 1.3.6.1.4.1.5322.10.1.12
|
||||||
|
+ NAME 'krb5RealmName'
|
||||||
|
+ EQUALITY octetStringMatch
|
||||||
|
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{128} )
|
||||||
|
+
|
||||||
|
+# Object class definitions
|
||||||
|
+
|
||||||
|
+objectclass ( 1.3.6.1.4.1.5322.10.2.1
|
||||||
|
+ NAME 'krb5Principal'
|
||||||
|
+ SUP top
|
||||||
|
+ AUXILIARY
|
||||||
|
+ MUST ( krb5PrincipalName )
|
||||||
|
+ MAY ( cn $ krb5PrincipalRealm ) )
|
||||||
|
+
|
||||||
|
+objectclass ( 1.3.6.1.4.1.5322.10.2.2
|
||||||
|
+ NAME 'krb5KDCEntry'
|
||||||
|
+ SUP krb5Principal
|
||||||
|
+ AUXILIARY
|
||||||
|
+ MUST ( krb5KeyVersionNumber )
|
||||||
|
+ MAY ( krb5ValidStart $ krb5ValidEnd $ krb5PasswordEnd $
|
||||||
|
+ krb5MaxLife $ krb5MaxRenew $ krb5KDCFlags $
|
||||||
|
+ krb5EncryptionType $ krb5Key ) )
|
||||||
|
+
|
||||||
|
+objectclass ( 1.3.6.1.4.1.5322.10.2.3
|
||||||
|
+ NAME 'krb5Realm'
|
||||||
|
+ SUP top
|
||||||
|
+ AUXILIARY
|
||||||
|
+ MUST ( krb5RealmName ) )
|
||||||
|
+
|
||||||
|
827
app-admin/mmc-agent/files/mmc-agent-2.3.2-printing-1.patch
Normal file
827
app-admin/mmc-agent/files/mmc-agent-2.3.2-printing-1.patch
Normal file
@ -0,0 +1,827 @@
|
|||||||
|
Submitted By: Mario Fetka (mario dot fetka at gmail dot com)
|
||||||
|
Date: 2009-01-15
|
||||||
|
Initial Package Version: 2.3.1
|
||||||
|
Origin: http://mds.mandriva.org/svn/mmc-agent/branches/printing/
|
||||||
|
Upstream Status: upstream
|
||||||
|
Description: patch in printing support to the mmc-agent package
|
||||||
|
|
||||||
|
diff -Naur mmc-agent-2.3.2.orig/conf/plugins/printing.ini mmc-agent-2.3.2/conf/plugins/printing.ini
|
||||||
|
--- mmc-agent-2.3.2.orig/conf/plugins/printing.ini 1970-01-01 00:00:00.000000000 +0000
|
||||||
|
+++ mmc-agent-2.3.2/conf/plugins/printing.ini 2009-01-15 16:32:36.801050135 +0000
|
||||||
|
@@ -0,0 +1,5 @@
|
||||||
|
+[main]
|
||||||
|
+# Is this plugin disabled ?
|
||||||
|
+disable = 0
|
||||||
|
+# Where are located the printers
|
||||||
|
+basePrintersDN = ou=Printers, dc=linbox, dc=com
|
||||||
|
diff -Naur mmc-agent-2.3.2.orig/conf/plugins/printstats.ini mmc-agent-2.3.2/conf/plugins/printstats.ini
|
||||||
|
--- mmc-agent-2.3.2.orig/conf/plugins/printstats.ini 1970-01-01 00:00:00.000000000 +0000
|
||||||
|
+++ mmc-agent-2.3.2/conf/plugins/printstats.ini 2009-01-15 16:32:36.802049976 +0000
|
||||||
|
@@ -0,0 +1,26 @@
|
||||||
|
+[main]
|
||||||
|
+disable = 0
|
||||||
|
+dbhost = localhost
|
||||||
|
+dbport = 5432
|
||||||
|
+dbname = lpstats
|
||||||
|
+dbuser = lpstats
|
||||||
|
+dbpasswd = lpstats
|
||||||
|
+
|
||||||
|
+[sql]
|
||||||
|
+history = SELECT sum(pages * copies), (SELECT EXTRACT(day FROM date)) AS day, (SELECT EXTRACT(month from date)) AS month, (SELECT EXTRACT(year from date)) AS year FROM linboxprintstats WHERE (now()::date - date::date <= %(days)d and printserver like '%(printserver)s') GROUP by day, month, year;
|
||||||
|
+
|
||||||
|
+historybymonth = SELECT sum(pages * copies), (SELECT EXTRACT(month from date)) AS month, (SELECT EXTRACT(year from date)) AS year FROM linboxprintstats WHERE (now()::date - date::date <= %(days)d and printserver like '%(printserver)s') GROUP by month, year;
|
||||||
|
+
|
||||||
|
+printers = select lps.printer as impr, coalesce(sum(lps.copies * lps.pages), 0) as total , (select coalesce(sum(lps2.copies * lps2.pages), 0) from linboxprintstats lps2 where (lps.printer = lps2.printer and lps2.color = 2 and lps2.date >= '%(begin)s' and lps2.date<='%(end)s' and lps2.printserver like '%(printserver)s')) as color, (select coalesce(sum(lps3.copies * lps3.pages), 0) from linboxprintstats lps3 where (lps3.printer = lps.printer and lps3.color <= 1 and lps3.date >= '%(begin)s' and lps3.date <= '%(end)s' and lps3.printserver like '%(printserver)s')) as bw from linboxprintstats lps where (lps.date >= '%(begin)s' and lps.date <= '%(end)s' and lps.printserver like '%(printserver)s') group by lps.printer order by %(orderby)s %(sort)s limit %(limit)s;
|
||||||
|
+
|
||||||
|
+users = select lps.username, coalesce(sum(lps.copies * lps.pages), 0) as total , (select coalesce(sum(lps2.copies * lps2.pages), 0) from linboxprintstats lps2 where (lps2.username = lps.username and lps2.color = 2 and lps2.date >= '%(begin)s' and lps2.date <= '%(end)s' and lps2.printserver like '%(printserver)s')) as color, (select coalesce(sum(lps3.copies * lps3.pages), 0) from linboxprintstats lps3 where (lps3.username = lps.username and lps3.color<=1 and lps3.date >= '%(begin)s' and lps3.date <= '%(end)s' and lps3.printserver like '%(printserver)s')) as bw from linboxprintstats lps where (lps.date >= '%(begin)s' and lps.date <= '%(end)s' and lps.printserver like '%(printserver)s') group by lps.username order by %(orderby)s %(sort)s limit %(limit)s;
|
||||||
|
+
|
||||||
|
+printer = select (select sum(lps2.copies) from linboxprintstats lps2 where (lps2.pages >= '%(lim1)d' and lps2.pages <= '%(lim2)d' and lps2.printer='%(printer)s' and lps2.date >= '%(begin)s' and date <= '%(end)s' and lps2.printserver like '%(printserver)s')), (select sum(lps3.copies) from linboxprintstats lps3 where (lps3.pages > '%(lim2)d' and lps3.pages <= '%(lim3)d' and lps3.printer='%(printer)s' and lps3.date >= '%(begin)s' and lps3.date <= '%(end)s') and lps3.printserver like '%(printserver)s'), (select sum(lps4.copies) from linboxprintstats lps4 where (lps4.pages > '%(lim3)s' and lps4.pages <= '%(lim4)s' and lps4.printer = '%(printer)s' and lps4.date >= '%(begin)s' and lps4.date <= '%(end)s' and lps4.printserver like '%(printserver)s')), (select sum(lps5.copies) from linboxprintstats lps5 where (lps5.pages > '%(lim4)s' and lps5.pages <= '%(lim5)s' and lps5.printer = '%(printer)s' and lps5.date >= '%(begin)s' and lps5.date <= '%(end)s' and lps5.printserver like '%(printserver)s')), (select sum(lps6.copies) from linboxprintstats lps6 where (lps6.pages > '%(lim5)s' and lps6.printer = '%(printer)s' and lps6.date >= '%(begin)s' and date <= '%(end)s' and lps6.printserver like '%(printserver)s')) from linboxprintstats limit 1;
|
||||||
|
+
|
||||||
|
+user4printer = select lps.username, coalesce(sum(lps.copies * lps.pages), 0) as total , (select coalesce(sum(lps2.copies * lps2.pages), 0) from linboxprintstats lps2 where (lps2.printer = '%(printer)s' and lps2.username = lps.username and lps2.color = 2 and lps2.date >= '%(begin)s' and lps2.date <= '%(end)s' and lps2.printserver like '%(printserver)s')) as color, (select coalesce(sum(lps3.copies * lps3.pages), 0) from linboxprintstats lps3 where (lps3.printer = '%(printer)s' and lps3.username = lps.username and lps3.color <= 1 and lps3.date >= '%(begin)s' and lps3.date <= '%(end)s' and lps3.printserver like '%(printserver)s')) as bw from linboxprintstats lps where (lps.printer = '%(printer)s' and lps.date >= '%(begin)s' and lps.date <= '%(end)s' and lps.printserver like '%(printserver)s') group by username order by %(orderby)s %(sort)s limit %(limit)s;
|
||||||
|
+
|
||||||
|
+printservers = select distinct(printserver) from linboxprintstats;
|
||||||
|
+
|
||||||
|
+printerlist = select distinct(printer) from linboxprintstats;
|
||||||
|
+
|
||||||
|
+colors = SELECT color,sum(copies*pages) from linboxprintstats WHERE (date >= '%(begin)s' and date <= '%(end)s' and printserver like '%(printserver)s') GROUP by color;
|
||||||
|
diff -Naur mmc-agent-2.3.2.orig/debian/control mmc-agent-2.3.2/debian/control
|
||||||
|
--- mmc-agent-2.3.2.orig/debian/control 2008-04-30 21:07:26.000000000 +0000
|
||||||
|
+++ mmc-agent-2.3.2/debian/control 2009-01-15 16:32:36.803050306 +0000
|
||||||
|
@@ -69,6 +69,22 @@
|
||||||
|
.
|
||||||
|
Homepage: http://mds.mandriva.org
|
||||||
|
|
||||||
|
+Package: python-mmc-printing
|
||||||
|
+Architecture: all
|
||||||
|
+Depends: ${python:Depends}, python-mmc-base (= 2.3.0-1)
|
||||||
|
+Description: Mandriva Management Console printing plugin
|
||||||
|
+ Printing management plugin for the MMC.
|
||||||
|
+ .
|
||||||
|
+ Homepage: http://mds.mandriva.org
|
||||||
|
+
|
||||||
|
+Package: python-mmc-printstats
|
||||||
|
+Architecture: all
|
||||||
|
+Depends: ${python:Depends}, python-mmc-base (= 2.3.0-1)
|
||||||
|
+Description: Mandriva Management Console printstats plugin
|
||||||
|
+ Printstats plugin for the MMC.
|
||||||
|
+ .
|
||||||
|
+ Homepage: http://mds.mandriva.org
|
||||||
|
+
|
||||||
|
Package: python-mmc-plugins-tools
|
||||||
|
Architecture: all
|
||||||
|
Replaces: python-lmc-plugins-tools
|
||||||
|
diff -Naur mmc-agent-2.3.2.orig/debian/control.in mmc-agent-2.3.2/debian/control.in
|
||||||
|
--- mmc-agent-2.3.2.orig/debian/control.in 2008-12-18 13:09:06.000000000 +0000
|
||||||
|
+++ mmc-agent-2.3.2/debian/control.in 2009-01-15 16:32:36.804050147 +0000
|
||||||
|
@@ -69,6 +69,22 @@
|
||||||
|
.
|
||||||
|
Homepage: http://mds.mandriva.org
|
||||||
|
|
||||||
|
+Package: python-mmc-printing
|
||||||
|
+Architecture: all
|
||||||
|
+Depends: ${python:Depends}, python-mmc-base (= 2.3.1-1mdv)
|
||||||
|
+Description: Mandriva Management Console printing plugin
|
||||||
|
+ Printing management plugin for the MMC.
|
||||||
|
+ .
|
||||||
|
+ Homepage: http://mds.mandriva.org
|
||||||
|
+
|
||||||
|
+Package: python-mmc-printstats
|
||||||
|
+Architecture: all
|
||||||
|
+Depends: ${python:Depends}, python-mmc-base (= 2.3.1-1mdv)
|
||||||
|
+Description: Mandriva Management Console printstats plugin
|
||||||
|
+ Printstats plugin for the MMC.
|
||||||
|
+ .
|
||||||
|
+ Homepage: http://mds.mandriva.org
|
||||||
|
+
|
||||||
|
Package: python-mmc-plugins-tools
|
||||||
|
Architecture: all
|
||||||
|
Replaces: python-lmc-plugins-tools
|
||||||
|
diff -Naur mmc-agent-2.3.2.orig/debian/python-mmc-printing.install mmc-agent-2.3.2/debian/python-mmc-printing.install
|
||||||
|
--- mmc-agent-2.3.2.orig/debian/python-mmc-printing.install 1970-01-01 00:00:00.000000000 +0000
|
||||||
|
+++ mmc-agent-2.3.2/debian/python-mmc-printing.install 2009-01-15 16:32:36.805045099 +0000
|
||||||
|
@@ -0,0 +1,2 @@
|
||||||
|
+usr/lib/python2.?/site-packages/mmc/plugins/printing
|
||||||
|
+etc/mmc/plugins/printing.ini
|
||||||
|
diff -Naur mmc-agent-2.3.2.orig/debian/python-mmc-printstats.install mmc-agent-2.3.2/debian/python-mmc-printstats.install
|
||||||
|
--- mmc-agent-2.3.2.orig/debian/python-mmc-printstats.install 1970-01-01 00:00:00.000000000 +0000
|
||||||
|
+++ mmc-agent-2.3.2/debian/python-mmc-printstats.install 2009-01-15 16:32:36.805045099 +0000
|
||||||
|
@@ -0,0 +1,2 @@
|
||||||
|
+usr/lib/python2.?/site-packages/mmc/plugins/printstats
|
||||||
|
+etc/mmc/plugins/printstats.ini
|
||||||
|
diff -Naur mmc-agent-2.3.2.orig/mmc/plugins/printing/__init__.py mmc-agent-2.3.2/mmc/plugins/printing/__init__.py
|
||||||
|
--- mmc-agent-2.3.2.orig/mmc/plugins/printing/__init__.py 1970-01-01 00:00:00.000000000 +0000
|
||||||
|
+++ mmc-agent-2.3.2/mmc/plugins/printing/__init__.py 2009-01-15 16:32:36.808050000 +0000
|
||||||
|
@@ -0,0 +1,480 @@
|
||||||
|
+# -*- coding: utf-8; -*-
|
||||||
|
+#
|
||||||
|
+# (c) 2004-2007 Linbox / Free&ALter Soft, http://linbox.com
|
||||||
|
+# (c) 2007-2008 Mandriva, http://www.mandriva.com
|
||||||
|
+#
|
||||||
|
+# $Id: __init__.py 642 2008-05-19 16:16:55Z cdelfosse $
|
||||||
|
+#
|
||||||
|
+# This file is part of Mandriva Management Console (MMC).
|
||||||
|
+#
|
||||||
|
+# MMC is free software; you can redistribute it and/or modify
|
||||||
|
+# it under the terms of the GNU General Public License as published by
|
||||||
|
+# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
+# (at your option) any later version.
|
||||||
|
+#
|
||||||
|
+# MMC is distributed in the hope that it will be useful,
|
||||||
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
+# GNU General Public License for more details.
|
||||||
|
+#
|
||||||
|
+# You should have received a copy of the GNU General Public License
|
||||||
|
+# along with MMC; if not, write to the Free Software
|
||||||
|
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
+
|
||||||
|
+import ConfigParser
|
||||||
|
+import logging
|
||||||
|
+
|
||||||
|
+import ldap
|
||||||
|
+from ldap.modlist import addModlist
|
||||||
|
+
|
||||||
|
+from mmc.plugins.base import ldapUserGroupControl, GpoManager
|
||||||
|
+from mmc.support import mmctools
|
||||||
|
+
|
||||||
|
+VERSION = "2.3.1"
|
||||||
|
+APIVERSION = "1:0:0"
|
||||||
|
+REVISION = int("$Rev: 642 $".split(':')[1].strip(' $'))
|
||||||
|
+
|
||||||
|
+def getVersion(): return VERSION
|
||||||
|
+def getApiVersion(): return APIVERSION
|
||||||
|
+def getRevision(): return REVISION
|
||||||
|
+
|
||||||
|
+def activate():
|
||||||
|
+ """
|
||||||
|
+ This function defines if this module can be activated
|
||||||
|
+ @return: return True if this module can be activated
|
||||||
|
+ @rtype: boolean
|
||||||
|
+ """
|
||||||
|
+ configParser = mmctools.getConfigParser("printing")
|
||||||
|
+ logger = logging.getLogger()
|
||||||
|
+ ret = False
|
||||||
|
+ if configParser.get("main", "disable") == "1":
|
||||||
|
+ logger.info("printing plugin disabled by configuration.")
|
||||||
|
+ else:
|
||||||
|
+ # Create Printers Ou
|
||||||
|
+ p = ldapPrinters()
|
||||||
|
+ head, path = p.basePrintersDN.split(",", 1)
|
||||||
|
+ ouName = head.split("=")[1]
|
||||||
|
+ try:
|
||||||
|
+ p.addOu(ouName, path)
|
||||||
|
+ logger.info("Created OU " + p.basePrintersDN)
|
||||||
|
+ except ldap.ALREADY_EXISTS:
|
||||||
|
+ pass
|
||||||
|
+ gpomanager = GpoManager("Printers")
|
||||||
|
+ try:
|
||||||
|
+ gpomanager.add("GPOPrintServiceAccessAllowed", { "ACLPrintServiceAccess" : "True" })
|
||||||
|
+ except ldap.ALREADY_EXISTS:
|
||||||
|
+ pass
|
||||||
|
+ try:
|
||||||
|
+ gpomanager.add("GPOPrintServiceAllRights", { "ACLPrintServiceAllRights" : "True" })
|
||||||
|
+ except ldap.ALREADY_EXISTS:
|
||||||
|
+ pass
|
||||||
|
+ ret = True
|
||||||
|
+ return ret
|
||||||
|
+
|
||||||
|
+# Printers management
|
||||||
|
+
|
||||||
|
+def get(pattern = "*"):
|
||||||
|
+ return ldapPrinters().get(pattern)
|
||||||
|
+
|
||||||
|
+def add(name, location = "", info = ""):
|
||||||
|
+ d = {}
|
||||||
|
+ d["printer-name"] = name
|
||||||
|
+ d["printer-location"] = location
|
||||||
|
+ d["printer-info"] = info
|
||||||
|
+ return ldapPrinters().add(d)
|
||||||
|
+
|
||||||
|
+def delete(name):
|
||||||
|
+ return ldapPrinters().delete(name)
|
||||||
|
+
|
||||||
|
+def exists(printer):
|
||||||
|
+ return ldapPrinters().exists(printer)
|
||||||
|
+
|
||||||
|
+# User rights management
|
||||||
|
+
|
||||||
|
+def addUserServiceAccessAllowed(uid):
|
||||||
|
+ ldapPrinters().addUserServiceAccessAllowed(uid)
|
||||||
|
+
|
||||||
|
+def delUserServiceAccessAllowed(uid):
|
||||||
|
+ ldapPrinters().delUserServiceAccessAllowed(uid)
|
||||||
|
+
|
||||||
|
+def isUserServiceAccessAllowed(uid):
|
||||||
|
+ return ldapPrinters().isUserServiceAccessAllowed(uid)
|
||||||
|
+
|
||||||
|
+def addUserServiceAllRights(uid):
|
||||||
|
+ ldapPrinters().addUserServiceAllRights(uid)
|
||||||
|
+
|
||||||
|
+def delUserServiceAllRights(uid):
|
||||||
|
+ ldapPrinters().delUserServiceAllRights(uid)
|
||||||
|
+
|
||||||
|
+def isUserServiceAllRights(uid):
|
||||||
|
+ return ldapPrinters().isUserServiceAllRights(uid)
|
||||||
|
+
|
||||||
|
+def addUserPrinterAccessAllowed(uid, printer):
|
||||||
|
+ ldapPrinters().addUserPrinterAccessAllowed(uid, printer)
|
||||||
|
+
|
||||||
|
+def delUserPrinterAccessAllowed(uid, printer):
|
||||||
|
+ ldapPrinters().delUserPrinterAccessAllowed(uid, printer)
|
||||||
|
+
|
||||||
|
+def getUserPrintersAccessAllowed(uid):
|
||||||
|
+ return ldapPrinters().getUserPrintersAccessAllowed(uid)
|
||||||
|
+
|
||||||
|
+# Group rights management
|
||||||
|
+
|
||||||
|
+def addGroupServiceAccessAllowed(group):
|
||||||
|
+ ldapPrinters().addGroupServiceAccessAllowed(group)
|
||||||
|
+
|
||||||
|
+def delGroupServiceAccessAllowed(group):
|
||||||
|
+ ldapPrinters().delGroupServiceAccessAllowed(group)
|
||||||
|
+
|
||||||
|
+def isGroupServiceAccessAllowed(group):
|
||||||
|
+ return ldapPrinters().isGroupServiceAccessAllowed(group)
|
||||||
|
+
|
||||||
|
+def addGroupServiceAllRights(group):
|
||||||
|
+ ldapPrinters().addGroupServiceAllRights(group)
|
||||||
|
+
|
||||||
|
+def delGroupServiceAllRights(group):
|
||||||
|
+ ldapPrinters().delGroupServiceAllRights(group)
|
||||||
|
+
|
||||||
|
+def isGroupServiceAllRights(group):
|
||||||
|
+ return ldapPrinters().isGroupServiceAllRights(group)
|
||||||
|
+
|
||||||
|
+def addGroupPrinterAccessAllowed(group, printer):
|
||||||
|
+ ldapPrinters().addGroupPrinterAccessAllowed(group, printer)
|
||||||
|
+
|
||||||
|
+def delGroupPrinterAccessAllowed(group, printer):
|
||||||
|
+ ldapPrinters().delGroupPrinterAccessAllowed(group, printer)
|
||||||
|
+
|
||||||
|
+def getGroupPrintersAccessAllowed(group):
|
||||||
|
+ return ldapPrinters().getGroupPrintersAccessAllowed(group)
|
||||||
|
+
|
||||||
|
+#
|
||||||
|
+
|
||||||
|
+def getUsersAccessAllowedForPrinter(printer):
|
||||||
|
+ return ldapPrinters().getUsersAccessAllowedForPrinter(printer)
|
||||||
|
+
|
||||||
|
+def getGroupsAccessAllowedForPrinter(printer):
|
||||||
|
+ return ldapPrinters().getGroupsAccessAllowedForPrinter(printer)
|
||||||
|
+
|
||||||
|
+#
|
||||||
|
+
|
||||||
|
+def getUsersPrintServiceGPO(gpo):
|
||||||
|
+ return ldapPrinters().getUsersPrintServiceGPO(gpo)
|
||||||
|
+
|
||||||
|
+def getGroupsPrintServiceGPO(gpo):
|
||||||
|
+ return ldapPrinters().getGroupsPrintServiceGPO(gpo)
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+class ldapPrinters(ldapUserGroupControl):
|
||||||
|
+
|
||||||
|
+ # Printers management methods
|
||||||
|
+ def __init__(self, conffile = None, conffilebase = None, gpoCreate = True):
|
||||||
|
+ """
|
||||||
|
+ @param gpoCreate: If True, base GPO for printer rights management will be created.
|
||||||
|
+ @type gpoCreate: bool
|
||||||
|
+ """
|
||||||
|
+ ldapUserGroupControl.__init__(self, conffilebase)
|
||||||
|
+ cp = ConfigParser.ConfigParser()
|
||||||
|
+ if not conffile:
|
||||||
|
+ cp = mmctools.getConfigParser("printing")
|
||||||
|
+ else:
|
||||||
|
+ cp = ConfigParser.ConfigParser()
|
||||||
|
+ cp.read(conffile)
|
||||||
|
+ self.basePrintersDN = cp.get("main", "basePrintersDN").replace(" ", "")
|
||||||
|
+ self.gpomanager = GpoManager("Printers", conffilebase, gpoCreate)
|
||||||
|
+
|
||||||
|
+ def get(self, pattern="*"):
|
||||||
|
+ """
|
||||||
|
+ Return the printers list found in the LDAP.
|
||||||
|
+ """
|
||||||
|
+ entries = self.search("printer-name="+pattern, self.basePrintersDN)
|
||||||
|
+ result = []
|
||||||
|
+ for entry in entries:
|
||||||
|
+ dn, attrs = entry[0]
|
||||||
|
+ result.append(attrs["printer-name"][0])
|
||||||
|
+ result.sort()
|
||||||
|
+ return result
|
||||||
|
+
|
||||||
|
+ def add(self, printerDesc):
|
||||||
|
+ """
|
||||||
|
+ Add a printer into the LDAP.
|
||||||
|
+
|
||||||
|
+ The GPOs corresponding to the printer are created too.
|
||||||
|
+ """
|
||||||
|
+ printerDesc["objectClass"] = ("printerService")
|
||||||
|
+ modlist = addModlist(printerDesc)
|
||||||
|
+ entry = "printer-name=" + printerDesc["printer-name"] + "," + self.basePrintersDN
|
||||||
|
+ self.l.add_s(entry, modlist)
|
||||||
|
+ self.gpomanager.add("GPOPrinterAccessAllowed_" + printerDesc["printer-name"], { "PrinterServiceAccess" : "True" })
|
||||||
|
+
|
||||||
|
+ def delete(self, name):
|
||||||
|
+ """
|
||||||
|
+ Delete a printer from the LDAP.
|
||||||
|
+
|
||||||
|
+ The GPOs corresponding to the printer are deleted too.
|
||||||
|
+ """
|
||||||
|
+ entry = "printer-name=" + name + ", " + self.basePrintersDN
|
||||||
|
+ self.delRecursiveEntry(entry)
|
||||||
|
+ self.gpomanager.delete("GPOPrinterAccessAllowed_" + name)
|
||||||
|
+
|
||||||
|
+ def exists(self, printer):
|
||||||
|
+ """
|
||||||
|
+ Return True if a printer with this name exists.
|
||||||
|
+ """
|
||||||
|
+ entry = self.search("printer-name=" + printer, self.basePrintersDN)
|
||||||
|
+ return (len(entry) == 1)
|
||||||
|
+
|
||||||
|
+ # Users rights management
|
||||||
|
+
|
||||||
|
+ def addUserServiceAccessAllowed(self, uid):
|
||||||
|
+ """
|
||||||
|
+ Give an user the right to access the print service
|
||||||
|
+
|
||||||
|
+ @param uid: user to give access
|
||||||
|
+ """
|
||||||
|
+ self.gpomanager.addUserToGPO(uid, "GPOPrintServiceAccessAllowed")
|
||||||
|
+
|
||||||
|
+ def delUserServiceAccessAllowed(self, uid):
|
||||||
|
+ """
|
||||||
|
+ Remove an user the right to access the print service
|
||||||
|
+
|
||||||
|
+ @param uid: user to give access
|
||||||
|
+ """
|
||||||
|
+ self.gpomanager.delUserFromGPO(uid, "GPOPrintServiceAccessAllowed")
|
||||||
|
+
|
||||||
|
+ def isUserServiceAccessAllowed(self, uid):
|
||||||
|
+ """
|
||||||
|
+ Return true if the user has print service access
|
||||||
|
+
|
||||||
|
+ @param uid: user to get access
|
||||||
|
+ @rtype: Boolean
|
||||||
|
+ """
|
||||||
|
+ dn = "uid=" + uid + "," + self.baseUsersDN
|
||||||
|
+ members = self.gpomanager.getUsersFromGPO("GPOPrintServiceAccessAllowed")
|
||||||
|
+ return dn in members
|
||||||
|
+
|
||||||
|
+ def addUserServiceAllRights(self, uid):
|
||||||
|
+ """
|
||||||
|
+ Give an user the right to access the print service without restriction
|
||||||
|
+
|
||||||
|
+ @param uid: user to give access
|
||||||
|
+ """
|
||||||
|
+ self.gpomanager.addUserToGPO(uid, "GPOPrintServiceAllRights")
|
||||||
|
+
|
||||||
|
+ def delUserServiceAllRights(self, uid):
|
||||||
|
+ """
|
||||||
|
+ Remove an user the right to access the print service without restriction
|
||||||
|
+
|
||||||
|
+ @param uid: user to give access
|
||||||
|
+ """
|
||||||
|
+ self.gpomanager.delUserFromGPO(uid, "GPOPrintServiceAllRights")
|
||||||
|
+
|
||||||
|
+ def isUserServiceAllRights(self, uid):
|
||||||
|
+ """
|
||||||
|
+ Return true if the user has print service access without restriction
|
||||||
|
+
|
||||||
|
+ @param uid: user to get access
|
||||||
|
+ @rtype: Boolean
|
||||||
|
+ """
|
||||||
|
+ dn = "uid=" + uid + "," + self.baseUsersDN
|
||||||
|
+ members = self.gpomanager.getUsersFromGPO("GPOPrintServiceAllRights")
|
||||||
|
+ return dn in members
|
||||||
|
+
|
||||||
|
+ def addUserPrinterAccessAllowed(self, uid, printer):
|
||||||
|
+ """
|
||||||
|
+ Give an user the right to use a printer
|
||||||
|
+
|
||||||
|
+ @param uid: user to give access
|
||||||
|
+ @param printer: printer name
|
||||||
|
+ """
|
||||||
|
+ self.gpomanager.addUserToGPO(uid, "GPOPrinterAccessAllowed_" + printer)
|
||||||
|
+
|
||||||
|
+ def delUserPrinterAccessAllowed(self, uid, printer):
|
||||||
|
+ """
|
||||||
|
+ Remove an user the right to access the print service
|
||||||
|
+
|
||||||
|
+ @param uid: user to give access
|
||||||
|
+ @param printer: printer name
|
||||||
|
+ """
|
||||||
|
+ self.gpomanager.delUserFromGPO(uid, "GPOPrinterAccessAllowed_" + printer)
|
||||||
|
+
|
||||||
|
+ def getUserPrintersAccessAllowed(self, uid):
|
||||||
|
+ """
|
||||||
|
+ Return the list of printers the user has right access
|
||||||
|
+
|
||||||
|
+ @param uid: user name
|
||||||
|
+ """
|
||||||
|
+ dn = "uid=" + uid + "," + self.baseUsersDN
|
||||||
|
+ return self.gpomanager.getResourceGpo(dn, "GPOPrinterAccessAllowed")
|
||||||
|
+
|
||||||
|
+ # Groups rights management
|
||||||
|
+
|
||||||
|
+ def addGroupServiceAccessAllowed(self, group):
|
||||||
|
+ """
|
||||||
|
+ Give a group the right to access the print service
|
||||||
|
+
|
||||||
|
+ @param group: group to give access to
|
||||||
|
+ """
|
||||||
|
+ self.gpomanager.addGroupToGPO(group, "GPOPrintServiceAccessAllowed")
|
||||||
|
+
|
||||||
|
+ def delGroupServiceAccessAllowed(self, group):
|
||||||
|
+ """
|
||||||
|
+ Remove a group the right to access the print service
|
||||||
|
+
|
||||||
|
+ @param group: group to give access to
|
||||||
|
+ """
|
||||||
|
+ self.gpomanager.delGroupFromGPO(group, "GPOPrintServiceAccessAllowed")
|
||||||
|
+
|
||||||
|
+ def isGroupServiceAccessAllowed(self, group):
|
||||||
|
+ """
|
||||||
|
+ Return true if the group has print service access
|
||||||
|
+
|
||||||
|
+ @param group: group to get access
|
||||||
|
+ @rtype: Boolean
|
||||||
|
+ """
|
||||||
|
+ dn = "cn=" + group + "," + self.baseGroupsDN
|
||||||
|
+ members = self.gpomanager.getGroupsFromGPO("GPOPrintServiceAccessAllowed")
|
||||||
|
+ return dn in members
|
||||||
|
+
|
||||||
|
+ def addGroupServiceAllRights(self, group):
|
||||||
|
+ """
|
||||||
|
+ Give a group the right to access to the print service without restriction
|
||||||
|
+
|
||||||
|
+ @param group: group to give access to
|
||||||
|
+ """
|
||||||
|
+ self.gpomanager.addGroupToGPO(group, "GPOPrintServiceAllRights")
|
||||||
|
+
|
||||||
|
+ def delGroupServiceAllRights(self, group):
|
||||||
|
+ """
|
||||||
|
+ Remove a group the right to access to the print service without restriction
|
||||||
|
+
|
||||||
|
+ @param group: group to give access to
|
||||||
|
+ """
|
||||||
|
+ self.gpomanager.delGroupFromGPO(group, "GPOPrintServiceAllRights")
|
||||||
|
+
|
||||||
|
+ def isGroupServiceAllRights(self, group):
|
||||||
|
+ """
|
||||||
|
+ Return true if the group has print service access without restriction
|
||||||
|
+
|
||||||
|
+ @param group: group to get access
|
||||||
|
+ @rtype: Boolean
|
||||||
|
+ """
|
||||||
|
+ dn = "cn=" + group + "," + self.baseGroupsDN
|
||||||
|
+ members = self.gpomanager.getGroupsFromGPO("GPOPrintServiceAllRights")
|
||||||
|
+ return dn in members
|
||||||
|
+
|
||||||
|
+ def addGroupPrinterAccessAllowed(self, group, printer):
|
||||||
|
+ """
|
||||||
|
+ Give a group the right to use a printer
|
||||||
|
+
|
||||||
|
+ @param group: group to give access
|
||||||
|
+ @param printer: printer name
|
||||||
|
+ """
|
||||||
|
+ self.gpomanager.addGroupToGPO(group, "GPOPrinterAccessAllowed_" + printer)
|
||||||
|
+
|
||||||
|
+ def delGroupPrinterAccessAllowed(self, group, printer):
|
||||||
|
+ """
|
||||||
|
+ Remove a group the right to access the print service
|
||||||
|
+
|
||||||
|
+ @param group: group to give access
|
||||||
|
+ @param printer: printer name
|
||||||
|
+ """
|
||||||
|
+ self.gpomanager.delGroupFromGPO(group, "GPOPrinterAccessAllowed_" + printer)
|
||||||
|
+
|
||||||
|
+ def getGroupPrintersAccessAllowed(self, group):
|
||||||
|
+ """
|
||||||
|
+ Return the list of printers the group has right access
|
||||||
|
+
|
||||||
|
+ @param group: group name
|
||||||
|
+ """
|
||||||
|
+ dn = "cn=" + group + "," + self.baseGroupsDN
|
||||||
|
+ return self.gpomanager.getResourceGpo(dn, "GPOPrinterAccessAllowed")
|
||||||
|
+
|
||||||
|
+ # Methods to know who can print on a specific printer
|
||||||
|
+
|
||||||
|
+ def getUsersAccessAllowedForPrinter(self, printer):
|
||||||
|
+ """
|
||||||
|
+ Return the list of users who can use this printer
|
||||||
|
+
|
||||||
|
+ @param printer: the printer name
|
||||||
|
+ """
|
||||||
|
+ ret = []
|
||||||
|
+ for dn in self.gpomanager.getUsersFromGPO("GPOPrinterAccessAllowed_" + printer):
|
||||||
|
+ # Process dn to only return the uid value
|
||||||
|
+ ret.append(dn.split(",")[0].split("=")[1])
|
||||||
|
+ return ret
|
||||||
|
+
|
||||||
|
+ def getGroupsAccessAllowedForPrinter(self, printer):
|
||||||
|
+ """
|
||||||
|
+ Return the list of groups who can use this printer
|
||||||
|
+
|
||||||
|
+ @param printer: the printer name
|
||||||
|
+ """
|
||||||
|
+ ret = []
|
||||||
|
+ for dn in self.gpomanager.getGroupsFromGPO("GPOPrinterAccessAllowed_" + printer):
|
||||||
|
+ # Process dn to only return the cn value
|
||||||
|
+ ret.append(dn.split(",")[0].split("=")[1])
|
||||||
|
+ return ret
|
||||||
|
+
|
||||||
|
+ # To get print service GPO members
|
||||||
|
+
|
||||||
|
+ def getUsersPrintServiceGPO(self, gpo):
|
||||||
|
+ """
|
||||||
|
+ Return the list of users member of the GPO.
|
||||||
|
+
|
||||||
|
+ @param gpo: Name of the GPO
|
||||||
|
+ """
|
||||||
|
+ ret = []
|
||||||
|
+ for dn in self.gpomanager.getUsersFromGPO(gpo):
|
||||||
|
+ # Process dn to only return the uid value
|
||||||
|
+ ret.append(dn.split(",")[0].split("=")[1])
|
||||||
|
+ return ret
|
||||||
|
+
|
||||||
|
+ def getGroupsPrintServiceGPO(self, gpo):
|
||||||
|
+ """
|
||||||
|
+ Return the list of groups member of this GPO
|
||||||
|
+
|
||||||
|
+ @param gpo: Name of the GPO
|
||||||
|
+ """
|
||||||
|
+ ret = []
|
||||||
|
+ for dn in self.gpomanager.getGroupsFromGPO(gpo):
|
||||||
|
+ # Process dn to only return the cn value
|
||||||
|
+ ret.append(dn.split(",")[0].split("=")[1])
|
||||||
|
+ return ret
|
||||||
|
+
|
||||||
|
+ def userCanPrintOn(self, uid, printer):
|
||||||
|
+ """
|
||||||
|
+ This method is used by the MMC CUPS backend to check if an user can print on a printer.
|
||||||
|
+ For the moment, only access right is checked according to group membership.
|
||||||
|
+
|
||||||
|
+ @return: True if the user uid can print on the printer
|
||||||
|
+ @rtype: boolean
|
||||||
|
+ """
|
||||||
|
+ result = False
|
||||||
|
+
|
||||||
|
+ groups = self.getUserGroups(uid)
|
||||||
|
+ # Get groups which has print service access
|
||||||
|
+ groupAccess = []
|
||||||
|
+ for group in groups:
|
||||||
|
+ if self.isGroupServiceAccessAllowed(group):
|
||||||
|
+ groupAccess.append(group)
|
||||||
|
+
|
||||||
|
+ # Get remaining group which has all rights on print service
|
||||||
|
+ groupAllrights = []
|
||||||
|
+ for group in groupAccess:
|
||||||
|
+ if self.isGroupServiceAllRights(group):
|
||||||
|
+ groupAllrights.append(group)
|
||||||
|
+
|
||||||
|
+ if len(groupAllrights):
|
||||||
|
+ # User is in a group which has all rights on print service.
|
||||||
|
+ # So this user can print
|
||||||
|
+ result = True
|
||||||
|
+ else:
|
||||||
|
+ # Does one of these groups has the right to use this printer ?
|
||||||
|
+ for group in groupAccess:
|
||||||
|
+ printers = self.getGroupPrintersAccessAllowed(group)
|
||||||
|
+ if printer in printers:
|
||||||
|
+ # We have a winner
|
||||||
|
+ result = True
|
||||||
|
+ break
|
||||||
|
+
|
||||||
|
+ return result
|
||||||
|
diff -Naur mmc-agent-2.3.2.orig/mmc/plugins/printstats/__init__.py mmc-agent-2.3.2/mmc/plugins/printstats/__init__.py
|
||||||
|
--- mmc-agent-2.3.2.orig/mmc/plugins/printstats/__init__.py 1970-01-01 00:00:00.000000000 +0000
|
||||||
|
+++ mmc-agent-2.3.2/mmc/plugins/printstats/__init__.py 2009-01-15 16:32:36.810050171 +0000
|
||||||
|
@@ -0,0 +1,219 @@
|
||||||
|
+# -*- coding: utf-8; -*-
|
||||||
|
+#
|
||||||
|
+# (c) 2004-2007 Linbox / Free&ALter Soft, http://linbox.com
|
||||||
|
+# (c) 2007 Mandriva, http://www.mandriva.com/
|
||||||
|
+#
|
||||||
|
+# $Id: __init__.py 454 2008-01-18 14:09:42Z cedric $
|
||||||
|
+#
|
||||||
|
+# This file is part of Mandriva Management Console (MMC).
|
||||||
|
+#
|
||||||
|
+# MMC is free software; you can redistribute it and/or modify
|
||||||
|
+# it under the terms of the GNU General Public License as published by
|
||||||
|
+# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
+# (at your option) any later version.
|
||||||
|
+#
|
||||||
|
+# MMC is distributed in the hope that it will be useful,
|
||||||
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
+# GNU General Public License for more details.
|
||||||
|
+#
|
||||||
|
+# You should have received a copy of the GNU General Public License
|
||||||
|
+# along with MMC; if not, write to the Free Software
|
||||||
|
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
+
|
||||||
|
+import psycopg
|
||||||
|
+import ConfigParser
|
||||||
|
+import logging
|
||||||
|
+from mmc.support import mmctools
|
||||||
|
+
|
||||||
|
+VERSION = "2.3.1"
|
||||||
|
+APIVERSION = "1:0:0"
|
||||||
|
+REVISION = int("$Rev: 557 $".split(':')[1].strip(' $'))
|
||||||
|
+
|
||||||
|
+def getVersion(): return VERSION
|
||||||
|
+def getApiVersion(): return APIVERSION
|
||||||
|
+def getRevision(): return REVISION
|
||||||
|
+
|
||||||
|
+def activate():
|
||||||
|
+ """
|
||||||
|
+ This function defines if this module can be activated
|
||||||
|
+ @return: return True if this module can be activated
|
||||||
|
+ @rtype: boolean
|
||||||
|
+ """
|
||||||
|
+ configParser = mmctools.getConfigParser("printstats")
|
||||||
|
+ logger = logging.getLogger()
|
||||||
|
+ ret = False
|
||||||
|
+ if configParser.get("main", "disable") == "1":
|
||||||
|
+ logger.info("printstats plugin disabled by configuration.")
|
||||||
|
+ else: ret = True
|
||||||
|
+ return ret
|
||||||
|
+
|
||||||
|
+def getHistory(printserver, days):
|
||||||
|
+ return Printstats().getHistory(printserver, days)
|
||||||
|
+
|
||||||
|
+def getHistoryByMonths(printserver, days):
|
||||||
|
+ return Printstats().getHistoryByMonths(printserver, days)
|
||||||
|
+
|
||||||
|
+def getPrintersStats(printserver, begin, end, orderby, sort, limit):
|
||||||
|
+ return Printstats().getPrintersStats(printserver, begin, end, orderby, sort, limit)
|
||||||
|
+
|
||||||
|
+def getPrinterStats(printserver, printer, begin, end, lim1, lim2, lim3, lim4, lim5):
|
||||||
|
+ return Printstats().getPrinterStats(printserver, printer, begin, end, lim1, lim2, lim3, lim4, lim5)
|
||||||
|
+
|
||||||
|
+def getUsersStatsForPrinter(printserver, printer, begin, end, orderby, sort, limit):
|
||||||
|
+ return Printstats().getUsersStatsForPrinter(printserver, printer, begin, end, orderby, sort, limit)
|
||||||
|
+
|
||||||
|
+def getUsersStats(printserver, begin, end, orderby, sort, limit):
|
||||||
|
+ return Printstats().getUsersStats(printserver, begin, end, orderby, sort, limit)
|
||||||
|
+
|
||||||
|
+def getPrintServers():
|
||||||
|
+ return Printstats().getPrintServers()
|
||||||
|
+
|
||||||
|
+def getPrinterList():
|
||||||
|
+ return Printstats().getPrinterList()
|
||||||
|
+
|
||||||
|
+def getColors(printserver, begin, end):
|
||||||
|
+ return Printstats().getColors(printserver, begin, end)
|
||||||
|
+
|
||||||
|
+class Printstats:
|
||||||
|
+
|
||||||
|
+ def __init__(self, conffile = "/etc/mmc/plugins/printstats.ini"):
|
||||||
|
+ cp = ConfigParser.RawConfigParser()
|
||||||
|
+ cp.read(conffile)
|
||||||
|
+ self.dbhost = cp.get("main", "dbhost")
|
||||||
|
+ self.dbport = cp.get("main", "dbport")
|
||||||
|
+ self.dbname = cp.get("main", "dbname")
|
||||||
|
+ self.dbuser = cp.get("main", "dbuser")
|
||||||
|
+ self.dbpasswd = cp.get("main", "dbpasswd")
|
||||||
|
+ self.sql = {}
|
||||||
|
+ for option in cp.options("sql"):
|
||||||
|
+ self.sql[option] = cp.get("sql", option)
|
||||||
|
+
|
||||||
|
+ def _getCursor(self):
|
||||||
|
+ l = logging.getLogger()
|
||||||
|
+ l.debug("Connecting to dbname=%s user=%s password=%s host=%s port=%s" % (self.dbname, self.dbuser, self.dbpasswd, self.dbhost, self.dbport))
|
||||||
|
+ self.db = psycopg.connect("dbname=%s user=%s password=%s host=%s port=%s" % (self.dbname, self.dbuser, self.dbpasswd, self.dbhost, self.dbport))
|
||||||
|
+ return self.db.cursor()
|
||||||
|
+
|
||||||
|
+ def _prepareData(self, data):
|
||||||
|
+ ret = []
|
||||||
|
+ for item in data:
|
||||||
|
+ if not None in item: ret.append(item)
|
||||||
|
+ else:
|
||||||
|
+ new = ()
|
||||||
|
+ for i in item:
|
||||||
|
+ if i == None: new = new + (0,)
|
||||||
|
+ else: new = new + (i,)
|
||||||
|
+ ret.append(new)
|
||||||
|
+ return ret
|
||||||
|
+
|
||||||
|
+ def _printServerQuery(self, printserver, where = False):
|
||||||
|
+ if printserver == "ALL": ret = "%"
|
||||||
|
+ else: ret = printserver
|
||||||
|
+ return ret
|
||||||
|
+
|
||||||
|
+ def getHistory(self, printserver, days):
|
||||||
|
+ c = self._getCursor()
|
||||||
|
+ d = {}
|
||||||
|
+ d["days"] = days
|
||||||
|
+ d["printserver"] = self._printServerQuery(printserver)
|
||||||
|
+ c.execute(self.sql["history"] % d)
|
||||||
|
+ ret = c.fetchall()
|
||||||
|
+ self.db.close()
|
||||||
|
+ return ret
|
||||||
|
+
|
||||||
|
+ def getHistoryByMonths(self, printserver, days):
|
||||||
|
+ c = self._getCursor()
|
||||||
|
+ d = {}
|
||||||
|
+ d["days"] = days
|
||||||
|
+ d["printserver"] = self._printServerQuery(printserver)
|
||||||
|
+ c.execute(self.sql["historybymonth"] % d)
|
||||||
|
+ ret = c.fetchall()
|
||||||
|
+ self.db.close()
|
||||||
|
+ return ret
|
||||||
|
+
|
||||||
|
+ def getPrintersStats(self, printserver, begin, end, orderby, sort, limit):
|
||||||
|
+ c = self._getCursor()
|
||||||
|
+ d = {}
|
||||||
|
+ d["begin"] = begin
|
||||||
|
+ d["end"] = end
|
||||||
|
+ d["printserver"] = self._printServerQuery(printserver)
|
||||||
|
+ d["orderby"] = orderby
|
||||||
|
+ d["sort"] = sort
|
||||||
|
+ d["limit"] = limit
|
||||||
|
+ c.execute(self.sql["printers"] % d)
|
||||||
|
+ result = c.fetchall()
|
||||||
|
+ self.db.close()
|
||||||
|
+ return self._prepareData(result)
|
||||||
|
+
|
||||||
|
+ def getUsersStats(self, printserver, begin, end, orderby, sort, limit):
|
||||||
|
+ c = self._getCursor()
|
||||||
|
+ d = {}
|
||||||
|
+ d["begin"] = begin
|
||||||
|
+ d["end"] = end
|
||||||
|
+ d["printserver"] = self._printServerQuery(printserver)
|
||||||
|
+ d["orderby"] = orderby
|
||||||
|
+ d["sort"] = sort
|
||||||
|
+ d["limit"] = limit
|
||||||
|
+ c.execute(self.sql["users"] % d)
|
||||||
|
+ ret = c.fetchall()
|
||||||
|
+ self.db.close()
|
||||||
|
+ return self._prepareData(ret)
|
||||||
|
+
|
||||||
|
+ def getPrinterStats(self, printserver, printer, begin, end, lim1, lim2, lim3, lim4, lim5):
|
||||||
|
+ c = self._getCursor()
|
||||||
|
+ d = {}
|
||||||
|
+ d["printserver"] = self._printServerQuery(printserver, True)
|
||||||
|
+ d["printer"] = printer
|
||||||
|
+ d["begin"] = begin
|
||||||
|
+ d["end"] = end
|
||||||
|
+ d["lim1"] = lim1
|
||||||
|
+ d["lim2"] = lim2
|
||||||
|
+ d["lim3"] = lim3
|
||||||
|
+ d["lim4"] = lim4
|
||||||
|
+ d["lim5"] = lim5
|
||||||
|
+ c.execute(self.sql["printer"] % d)
|
||||||
|
+ ret = c.fetchall()
|
||||||
|
+ self.db.close()
|
||||||
|
+ return self._prepareData(ret)
|
||||||
|
+
|
||||||
|
+ def getUsersStatsForPrinter(self, printserver, printer, begin, end, orderby, sort, limit):
|
||||||
|
+ d = {}
|
||||||
|
+ d["printserver"] = self._printServerQuery(printserver)
|
||||||
|
+ d["printer"] = printer
|
||||||
|
+ d["begin"] = begin
|
||||||
|
+ d["end"] = end
|
||||||
|
+ d["orderby"] = orderby
|
||||||
|
+ d["sort"] = sort
|
||||||
|
+ d["limit"] = limit
|
||||||
|
+ c = self._getCursor()
|
||||||
|
+ c.execute(self.sql["user4printer"] % d)
|
||||||
|
+ ret = c.fetchall()
|
||||||
|
+ self.db.close()
|
||||||
|
+ return self._prepareData(ret)
|
||||||
|
+
|
||||||
|
+ def getPrintServers(self):
|
||||||
|
+ c = self._getCursor()
|
||||||
|
+ c.execute(self.sql["printservers"])
|
||||||
|
+ ret = c.fetchall()
|
||||||
|
+ self.db.close()
|
||||||
|
+ return self._prepareData(ret)
|
||||||
|
+
|
||||||
|
+ def getPrinterList(self):
|
||||||
|
+ c = self._getCursor()
|
||||||
|
+ c.execute(self.sql["printerlist"])
|
||||||
|
+ ret = c.fetchall()
|
||||||
|
+ self.db.close()
|
||||||
|
+ return self._prepareData(ret)
|
||||||
|
+
|
||||||
|
+ def getColors(self, printserver, begin, end):
|
||||||
|
+ d = {}
|
||||||
|
+ d["printserver"] = self._printServerQuery(printserver)
|
||||||
|
+ d["begin"] = begin
|
||||||
|
+ d["end"] = end
|
||||||
|
+ c = self._getCursor()
|
||||||
|
+ c.execute(self.sql["colors"] % d)
|
||||||
|
+ ret = c.fetchall()
|
||||||
|
+ self.db.close()
|
||||||
|
+ return self._prepareData(ret)
|
||||||
|
+
|
||||||
|
diff -Naur mmc-agent-2.3.2.orig/setup.py mmc-agent-2.3.2/setup.py
|
||||||
|
--- mmc-agent-2.3.2.orig/setup.py 2007-09-10 08:20:59.000000000 +0000
|
||||||
|
+++ mmc-agent-2.3.2/setup.py 2009-01-15 16:32:36.811050501 +0000
|
||||||
|
@@ -8,5 +8,5 @@
|
||||||
|
author_email = "cdelfosse@mandriva.com",
|
||||||
|
maintainer = "Cedric Delfosse",
|
||||||
|
maintainer_email = "cdelfosse@mandriva.com",
|
||||||
|
- packages = ["mmc", "mmc.support", "mmc.plugins", "mmc.plugins.base", "mmc.plugins.samba", "mmc.plugins.proxy", "mmc.plugins.mail", "mmc.plugins.network", "mmc.plugins.kerberos"],
|
||||||
|
+ packages = ["mmc", "mmc.support", "mmc.plugins", "mmc.plugins.base", "mmc.plugins.samba", "mmc.plugins.proxy", "mmc.plugins.mail", "mmc.plugins.network", "mmc.plugins.kerberos", "mmc.plugins.printstats", "mmc.plugins.printing"],
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user