Subversion Repositories SmartDukaan

Rev

Rev 5937 | Rev 7065 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5937 Rev 7058
Line 6... Line 6...
6
import in.shop2020.crm.Agent;
6
import in.shop2020.crm.Agent;
7
import in.shop2020.crm.SearchFilter;
7
import in.shop2020.crm.SearchFilter;
8
import in.shop2020.serving.auth.CRMAuthorizingRealm;
8
import in.shop2020.serving.auth.CRMAuthorizingRealm;
9
import in.shop2020.thrift.clients.CRMClient;
9
import in.shop2020.thrift.clients.CRMClient;
10
 
10
 
-
 
11
import org.apache.commons.lang.StringUtils;
11
import org.apache.shiro.crypto.hash.Sha256Hash;
12
import org.apache.shiro.crypto.hash.Sha256Hash;
12
import org.apache.thrift.TException;
13
import org.apache.thrift.TException;
13
import org.apache.thrift.transport.TTransportException;
14
import org.apache.thrift.transport.TTransportException;
14
 
15
 
15
public class AgentController extends BaseController {
16
public class AgentController extends BaseController {
Line 158... Line 159...
158
		this.newPassword = newPassword;
159
		this.newPassword = newPassword;
159
	}
160
	}
160
 
161
 
161
	public List<Agent> getAgents() {
162
	public List<Agent> getAgents() {
162
		String currentEmailId = getCurrentAgentEmailId();
163
		String currentEmailId = getCurrentAgentEmailId();
-
 
164
		log.info("currentEmailId="+currentEmailId);
163
		long managerId = 0;
165
		long managerId =0;
164
		List<Agent> managedAgents = new ArrayList<Agent>();
166
		List<Agent> managedAgents = new ArrayList<Agent>();
165
		for(Agent tempAgent : agents) {
167
		for(Agent tempAgent : agents) {
166
			if(tempAgent.getEmailId().equals(currentEmailId)) {
168
			if(StringUtils.equalsIgnoreCase(tempAgent.getEmailId(), currentEmailId)) {
167
				managerId = tempAgent.getId();
169
				managerId = tempAgent.getId();
168
				break;
170
				break;
169
			}
171
			}
170
		}
172
		}
171
		
173
		
172
		if(!currentEmailId.equals(adminEmailId)) {
174
		if(currentEmailId.equals(adminEmailId)) {
173
			return agents;
175
			return agents;
174
		} else {
176
		} else {
175
			if(managerId!=0) {
177
			if(managerId!=0) {
176
				for(Agent tempAgent : agents) {
178
				for(Agent tempAgent : agents) {
177
					if(tempAgent.getManagerId() == managerId){
179
					if(tempAgent.getManagerId() == managerId){
Line 179... Line 181...
179
					}
181
					}
180
				}
182
				}
181
				return managedAgents;
183
				return managedAgents;
182
			}
184
			}
183
			else {
185
			else {
184
				return agents;
186
				return null;
185
			}
187
			}
186
				
188
				
187
		}
189
		}
188
		
190
		
189
	}
191
	}