[Samba] Modifying SWAT views for general users

Deryck Hodge deryck at samba.org
Wed Feb 2 18:16:07 GMT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Roy P Costa wrote:
| I'm looking at having my general Samba users change their own
passwords on
| my Linux server using SWAT.  Is there a way that I can have them have
| access to the password changing view and not be able to see the
| configuration and status information.  Is there an easy way for those
| "button" to not appear on the web page?
|
|
| Roy Costa
| roycosta at us.ibm.com
|
|

I've just committed the attached patch to SVN.  It adds a '-P'
command-line option to SWAT.  Running swat -P will now do what you asked
about above -- only show the "Password" menu to read-only users.  Please
test it, and let us know if it works out for you.  Cheers,

deryck

- --
Deryck Hodge                            http://www.devurandom.org/
Auburn University Libraries             http://www.lib.auburn.edu/
Samba Team                              http://www.samba.org/

I am flawed but I am cleaning up so well.
- --Dashboard Confessional, from "Vindicated"(2004)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCARjn4glRK0DaE8gRAnA0AJ9kJD5ypPISeNc7XNtdUufkDVYKcACgow9Y
ztvJGe2eqhkDJ3Jt2msvRRk=
=5WaD
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: source/web/swat.c
===================================================================
--- source/web/swat.c	(revision 5172)
+++ source/web/swat.c	(working copy)
@@ -32,6 +32,7 @@
 #include "web/swat_proto.h"
 
 static BOOL demo_mode = False;
+static BOOL passwd_only = False;
 static BOOL have_write_access = False;
 static BOOL have_read_access = False;
 static int iNumNonAutoPrintServices = 0;
@@ -530,7 +531,8 @@
 		image_link(_("Printers"), "printers", "images/printers.gif");
 		image_link(_("Wizard"), "wizard", "images/wizard.gif");
 	}
-	if (have_read_access) {
+   /* root always gets all buttons, otherwise look for -P */
+	if ( have_write_access || (!passwd_only && have_read_access) ) {
 		image_link(_("Status"), "status", "images/status.gif");
 		image_link(_("View Config"), "viewconfig", "images/viewconfig.gif");
 	}
@@ -1315,6 +1317,7 @@
 	struct poptOption long_options[] = {
 		POPT_AUTOHELP
 		{ "disable-authentication", 'a', POPT_ARG_VAL, &demo_mode, True, "Disable authentication (demo mode)" },
+        { "password-menu-only", 'P', POPT_ARG_VAL, &passwd_only, True, "Show only change password menu" }, 
 		POPT_COMMON_SAMBA
 		POPT_TABLEEND
 	};


More information about the samba mailing list