- Timestamp:
- 09/04/11 21:44:37 (9 months ago)
- Branch:
- default
- Convert:
- svn:7c3792e6-d75b-4784-96a6-b298f655ee64/trunk@2723
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kraken-dom/src/main/java/org/krakenapps/dom/msgbus/AdminPlugin.java
r282 r289 95 95 96 96 Admin admin = toAdmin(req); 97 if (admin.isUseOtp()) 98 admin.setOtpSeed(createOtpSeed()); 97 99 admin.setUser(user); 98 100 adminApi.createAdmin(req.getOrgId(), req.getAdminId(), admin); … … 143 145 } 144 146 147 @MsgbusMethod 148 public void updateOtpSeed(Request req, Response resp) { 149 if (req.getAdminId() == null) 150 throw new SecurityException("not admin"); 151 152 Admin admin = adminApi.getAdmin(req.getOrgId(), req.getAdminId()); 153 if (admin == null) 154 throw new IllegalArgumentException("admin not found"); 155 156 if (admin.isUseOtp()) 157 admin.setOtpSeed(createOtpSeed()); 158 else 159 admin.setOtpSeed(null); 160 161 adminApi.updateAdmin(req.getOrgId(), req.getAdminId(), admin); 162 resp.put("otp_seed", admin.getOtpSeed()); 163 } 164 145 165 private Admin toAdmin(Request req) throws RoleNotFoundException { 146 166 Admin admin = new Admin(); … … 156 176 if (profile == null) 157 177 throw new ProgramProfileNotFoundException(profileId); 158 178 159 179 admin.setProgramProfile(profile); 160 180 admin.setUseLoginLock(req.getBoolean("use_login_lock")); … … 164 184 admin.setIdleTimeout(req.getInteger("idle_timeout")); 165 185 admin.setEnabled(req.getBoolean("is_enabled")); 186 admin.setUseOtp(req.getBoolean("use_otp")); 187 if (admin.isUseOtp()) 188 admin.setOtpSeed(null); 166 189 167 190 admin.validate(); 168 191 return admin; 169 192 } 193 194 private String createOtpSeed() { 195 return null; 196 } 170 197 }
Note: See TracChangeset
for help on using the changeset viewer.
