1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mageia-sysadm] [140] Merge 138 from trunk, allow configurable login attribute
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mageia-sysadm%40mageia.org?Subject=Re%3A%20%5BMageia-sysadm%5D%20%5B140%5D%20Merge%20138%20from%20trunk%2C%0A%09allow%20configurable%20login%20attribute&In-Reply-To=%3C20101125113717.8FDA33FD60%40valstar.mageia.org%3E">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="000917.html">
<LINK REL="Next" HREF="000919.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mageia-sysadm] [140] Merge 138 from trunk, allow configurable login attribute</H1>
<B>root at mageia.org</B>
<A HREF="mailto:mageia-sysadm%40mageia.org?Subject=Re%3A%20%5BMageia-sysadm%5D%20%5B140%5D%20Merge%20138%20from%20trunk%2C%0A%09allow%20configurable%20login%20attribute&In-Reply-To=%3C20101125113717.8FDA33FD60%40valstar.mageia.org%3E"
TITLE="[Mageia-sysadm] [140] Merge 138 from trunk, allow configurable login attribute">root at mageia.org
</A><BR>
<I>Thu Nov 25 12:37:17 CET 2010</I>
<P><UL>
<LI>Previous message: <A HREF="000917.html">[Mageia-sysadm] [139] Dont hardcode filters, but use user's store configuration
</A></li>
<LI>Next message: <A HREF="000919.html">[Mageia-sysadm] [141] create rejected directory if needed
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#918">[ date ]</a>
<a href="thread.html#918">[ thread ]</a>
<a href="subject.html#918">[ subject ]</a>
<a href="author.html#918">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Revision: 140
Author: buchan
Date: 2010-11-25 12:37:17 +0100 (Thu, 25 Nov 2010)
Log Message:
-----------
Merge 138 from trunk, allow configurable login attribute
Modified Paths:
--------------
identity/CatDap/branches/live/lib/CatDap/Controller/user.pm
Modified: identity/CatDap/branches/live/lib/CatDap/Controller/user.pm
===================================================================
--- identity/CatDap/branches/live/lib/CatDap/Controller/user.pm 2010-11-25 11:34:51 UTC (rev 139)
+++ identity/CatDap/branches/live/lib/CatDap/Controller/user.pm 2010-11-25 11:37:17 UTC (rev 140)
@@ -122,6 +122,7 @@
my $password;
my $mesg;
my $dn;
+ my $userfilter;
if (not defined $c->user ) {
$c->stash(template => 'index.tt');
@@ -136,8 +137,10 @@
my $user = $c->user->username;
my $entry;
- $c->log->debug("Searching for user $user");
- $mesg = $c->model('User')->search("(&(objectclass=inetOrgPerson)(uid=$user))");
+ $userfilter = $c->user->store->user_filter;
+ $userfilter =~ s/\%s/$user/g,
+ $c->log->debug("Searching for user $user with filter $userfilter");
+ $mesg = $c->model('User')->search($userfilter);
$entry = $mesg->entry;
my %mods;
my %params = %{$c->req->parameters};
@@ -161,7 +164,7 @@
}
}
- $mesg = $c->model('User')->search("(&(objectclass=inetOrgPerson)(uid=$user))");
+ $mesg = $c->model('User')->search($userfilter);
$c->log->debug($mesg->error) if $mesg->code;
$entry = $mesg->entry;
$c->log->debug($mesg->error) if $mesg->code;
@@ -218,12 +221,14 @@
sub add : Local {
my ( $self, $c) = @_;
- my ($mesg,$entry,$user,$attr,$value);
+ my ($mesg,$entry,$user,$attr,$value,$userfilter);
$attr = $c->req->param('attribute');
$value = $c->req->param('value');
$user = $c->user->username;
- $c->log->debug("Searching for user $user");
- $mesg = $c->model('User')->search("(&(objectclass=inetOrgPerson)(uid=$user))");
+ $userfilter = $c->user->store->user_filter;
+ $userfilter = s/%s/$c->user->username/g;
+ $c->log->debug("Searching for user $user with $userfilter");
+ $mesg = $c->model('User')->search($userfilter);
$entry = $mesg->entry;
$entry->add( $attr => $value);
$c->log->info("Adding $attr = $value to user $user");
@@ -235,10 +240,12 @@
sub delete : Local : Args(2) {
my ( $self, $c, $attrname,$attrvalue) = @_;
- my ($mesg,$entry,$user);
+ my ($mesg,$entry,$user,$userfilter);
$user = $c->user->username;
+ $userfilter = $c->user->store->user_filter;
+ $userfilter =~ s/%s/$c->user->username/g;
$c->log->debug("Searching for user $user");
- $mesg = $c->model('User')->search("(&(objectclass=inetOrgPerson)(uid=$user))");
+ $mesg = $c->model('User')->search($userfilter);
$entry = $mesg->entry;
$c->log->info("Deleting $attrname = $attrvalue from user $user");
$entry->delete($attrname => $attrvalue);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/mageia-sysadm/attachments/20101125/d309ad36/attachment.html>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="000917.html">[Mageia-sysadm] [139] Dont hardcode filters, but use user's store configuration
</A></li>
<LI>Next message: <A HREF="000919.html">[Mageia-sysadm] [141] create rejected directory if needed
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#918">[ date ]</a>
<a href="thread.html#918">[ thread ]</a>
<a href="subject.html#918">[ subject ]</a>
<a href="author.html#918">[ author ]</a>
</LI>
</UL>
<hr>
<a href="https://www.mageia.org/mailman/listinfo/mageia-sysadm">More information about the Mageia-sysadm
mailing list</a><br>
</body></html>
|