| 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 |
/**
|
|
|
10 |
* Who may change a partner store's status. Shared by the fofo RetailerController and the web V2FofoRetailerController
|
|
|
11 |
* so the two copies of each endpoint cannot drift apart.
|
|
|
12 |
*/
|
|
|
13 |
public final class StoreAccess {
|
|
|
14 |
|
|
|
15 |
public static final List<String> CLOSE = Collections.unmodifiableList(Arrays.asList(
|
|
|
16 |
"kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
|
|
|
17 |
"vikas.jangra@smartdukaan.com", "neeraj.gupta@smartdukaan.com"));
|
|
|
18 |
|
|
|
19 |
public static final List<String> DEACTIVATE = Collections.unmodifiableList(Arrays.asList(
|
|
|
20 |
"kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com",
|
|
|
21 |
"vikas.jangra@smartdukaan.com"));
|
|
|
22 |
|
|
|
23 |
public static final List<String> ACTIVATE = Collections.unmodifiableList(Arrays.asList(
|
|
|
24 |
"kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "amit.gupta@smartdukaan.com"));
|
|
|
25 |
|
|
|
26 |
public static final List<String> EXTEND_BILLING = ACTIVATE;
|
|
|
27 |
|
|
|
28 |
private StoreAccess() {
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
/**
|
|
|
32 |
* @param action the verb shown in the error, e.g. "close store"
|
|
|
33 |
*/
|
|
|
34 |
public static void check(List<String> allowed, String emailId, String action) throws ProfitMandiBusinessException {
|
|
|
35 |
if (emailId == null || !allowed.contains(emailId)) {
|
|
|
36 |
throw new ProfitMandiBusinessException("Access Denied", "Unauthorised Access",
|
|
|
37 |
"You are not authorise to " + action);
|
|
|
38 |
}
|
|
|
39 |
}
|
|
|
40 |
}
|