Subversion Repositories SmartDukaan

Rev

Rev 37764 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
37764 amit 1
package com.spice.profitmandi.service.user;
2
 
3
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
4
 
5
import java.util.Arrays;
6
import java.util.Collections;
7
import java.util.List;
8
 
9
/**
37935 amit 10
 * Who may extend a store's billing grace date. Shared by the fofo RetailerController and the web
11
 * V2FofoRetailerController. Store status changes are authorised by StoreStatusService instead.
37764 amit 12
 */
13
public final class StoreAccess {
14
 
37935 amit 15
	public static final List<String> EXTEND_BILLING = Collections.unmodifiableList(Arrays.asList(
37764 amit 16
			"kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com"));
17
 
18
	private StoreAccess() {
19
	}
20
 
21
	/**
22
	 * @param action the verb shown in the error, e.g. "close store"
23
	 */
24
	public static void check(List<String> allowed, String emailId, String action) throws ProfitMandiBusinessException {
25
		if (emailId == null || !allowed.contains(emailId)) {
26
			throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
27
					"You are not authorise to " + action);
28
		}
29
	}
30
}