mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Email format
This commit is contained in:
commit
e6d0d3fd00
@ -22,6 +22,7 @@ import java.util.List;
|
|||||||
public class Feature {
|
public class Feature {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
|
private String code;
|
||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
private String deviceType;
|
private String deviceType;
|
||||||
@ -35,6 +36,14 @@ public class Feature {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,4 +56,6 @@ public interface OperationManager {
|
|||||||
*/
|
*/
|
||||||
public List<Operation> getPendingOperations(DeviceIdentifier deviceId) throws OperationManagementException;
|
public List<Operation> getPendingOperations(DeviceIdentifier deviceId) throws OperationManagementException;
|
||||||
|
|
||||||
|
public Operation getPendingOperation(DeviceIdentifier deviceId) throws OperationManagementException;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -75,6 +75,13 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FeatureManager getFeatureManager(String type) {
|
||||||
|
DeviceManager dms =
|
||||||
|
this.getPluginRepository().getDeviceManagementProvider(type);
|
||||||
|
return dms.getFeatureManager();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean enrollDevice(Device device) throws DeviceManagementException {
|
public boolean enrollDevice(Device device) throws DeviceManagementException {
|
||||||
DeviceManager dms =
|
DeviceManager dms =
|
||||||
@ -346,4 +353,9 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
|
|||||||
return operationManager.getPendingOperations(deviceId);
|
return operationManager.getPendingOperations(deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Operation getPendingOperation(DeviceIdentifier deviceId) throws OperationManagementException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,6 +85,11 @@ public class OperationManagerImpl implements OperationManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Operation getPendingOperation(DeviceIdentifier deviceId) throws OperationManagementException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private OperationDAO lookupOperationDAO(Operation operation) {
|
private OperationDAO lookupOperationDAO(Operation operation) {
|
||||||
if (operation instanceof CommandOperation) {
|
if (operation instanceof CommandOperation) {
|
||||||
return commandOperationDAO;
|
return commandOperationDAO;
|
||||||
|
|||||||
@ -20,6 +20,7 @@ package org.wso2.carbon.device.mgt.core.service;
|
|||||||
import org.wso2.carbon.device.mgt.common.Device;
|
import org.wso2.carbon.device.mgt.common.Device;
|
||||||
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
||||||
import org.wso2.carbon.device.mgt.common.EmailMessageProperties;
|
import org.wso2.carbon.device.mgt.common.EmailMessageProperties;
|
||||||
|
import org.wso2.carbon.device.mgt.common.FeatureManager;
|
||||||
import org.wso2.carbon.device.mgt.common.spi.DeviceManager;
|
import org.wso2.carbon.device.mgt.common.spi.DeviceManager;
|
||||||
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
|
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
|
||||||
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
|
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
|
||||||
@ -40,4 +41,6 @@ public interface DeviceManagementService extends DeviceManager, LicenseManager,
|
|||||||
|
|
||||||
void sendEnrollInvitation(String title, String userName, String emailAddress, String enrolUrl) throws DeviceManagementException;
|
void sendEnrollInvitation(String title, String userName, String emailAddress, String enrolUrl) throws DeviceManagementException;
|
||||||
|
|
||||||
|
FeatureManager getFeatureManager(String type) throws DeviceManagementException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,11 +85,8 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|||||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDeviceListOfUser(username);
|
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDeviceListOfUser(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public FeatureManager getFeatureManager(String type) throws DeviceManagementException {
|
||||||
public void sendEnrollInvitation(String title, String userName, String emailAddress, String enrolUrl)
|
return null;
|
||||||
throws DeviceManagementException {
|
|
||||||
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
|
|
||||||
.sendEnrollInvitation(title, userName, emailAddress, enrolUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -136,4 +133,15 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|||||||
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getPendingOperations(deviceId);
|
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getPendingOperations(deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Operation getPendingOperation(DeviceIdentifier deviceId) throws OperationManagementException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendEnrollInvitation(String title, String userName, String emailAddress, String enrolUrl)
|
||||||
|
throws DeviceManagementException {
|
||||||
|
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
|
||||||
|
.sendEnrollInvitation(title, userName, emailAddress, enrolUrl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,4 +28,5 @@ public interface UserManager {
|
|||||||
public List<User> getUsersForTenantAndRole(int tenantId, String roleName) throws UserManagementException;
|
public List<User> getUsersForTenantAndRole(int tenantId, String roleName) throws UserManagementException;
|
||||||
public List<Role> getRolesForTenant(int tenantId) throws UserManagementException;
|
public List<Role> getRolesForTenant(int tenantId) throws UserManagementException;
|
||||||
public List<User> getUsersForTenant(int tenantId) throws UserManagementException;
|
public List<User> getUsersForTenant(int tenantId) throws UserManagementException;
|
||||||
|
public User getUser(String username, int tenantId) throws UserManagementException;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,12 +20,10 @@ package org.wso2.carbon.device.mgt.user.core;
|
|||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.wso2.carbon.device.mgt.user.common.Claims;
|
|
||||||
import org.wso2.carbon.device.mgt.user.common.Role;
|
import org.wso2.carbon.device.mgt.user.common.Role;
|
||||||
import org.wso2.carbon.device.mgt.user.common.User;
|
import org.wso2.carbon.device.mgt.user.common.User;
|
||||||
import org.wso2.carbon.device.mgt.user.common.UserManagementException;
|
import org.wso2.carbon.device.mgt.user.common.UserManagementException;
|
||||||
import org.wso2.carbon.device.mgt.user.core.internal.DeviceMgtUserDataHolder;
|
import org.wso2.carbon.device.mgt.user.core.internal.DeviceMgtUserDataHolder;
|
||||||
import org.wso2.carbon.user.api.Claim;
|
|
||||||
import org.wso2.carbon.user.api.UserStoreException;
|
import org.wso2.carbon.user.api.UserStoreException;
|
||||||
import org.wso2.carbon.user.api.UserStoreManager;
|
import org.wso2.carbon.user.api.UserStoreManager;
|
||||||
import org.wso2.carbon.user.core.UserCoreConstants;
|
import org.wso2.carbon.user.core.UserCoreConstants;
|
||||||
@ -148,8 +146,24 @@ public class UserManagerImpl implements UserManager {
|
|||||||
return usersList;
|
return usersList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUserClaims(User newUser, Map<String, String> claimMap) {
|
@Override public User getUser(String username, int tenantId) throws UserManagementException {
|
||||||
|
UserStoreManager userStoreManager;
|
||||||
|
User user;
|
||||||
|
try {
|
||||||
|
userStoreManager = DeviceMgtUserDataHolder.getInstance().getRealmService().getTenantUserRealm(tenantId)
|
||||||
|
.getUserStoreManager();
|
||||||
|
user = new User(username);
|
||||||
|
setUserClaims(user, userStoreManager
|
||||||
|
.getUserClaimValues(username, DEFAULT_CLAIM_ARR, UserCoreConstants.DEFAULT_PROFILE));
|
||||||
|
} catch (UserStoreException userStoreEx) {
|
||||||
|
String errorMsg = "User store error in fetching user " + username;
|
||||||
|
log.error(errorMsg, userStoreEx);
|
||||||
|
throw new UserManagementException(errorMsg, userStoreEx);
|
||||||
|
}
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setUserClaims(User newUser, Map<String, String> claimMap) {
|
||||||
newUser.setRoleName(UserCoreConstants.ClaimTypeURIs.ROLE);
|
newUser.setRoleName(UserCoreConstants.ClaimTypeURIs.ROLE);
|
||||||
newUser.setAccountStatus(claimMap.get(ACCOUNT_STATUS));
|
newUser.setAccountStatus(claimMap.get(ACCOUNT_STATUS));
|
||||||
newUser.setChallengeQuestion(claimMap.get(CHALLENGE_QUESTION_URI));
|
newUser.setChallengeQuestion(claimMap.get(CHALLENGE_QUESTION_URI));
|
||||||
|
|||||||
@ -43,4 +43,9 @@ public class UserManagementService implements UserManager{
|
|||||||
public List<User> getUsersForTenant(int tenantId) throws UserManagementException {
|
public List<User> getUsersForTenant(int tenantId) throws UserManagementException {
|
||||||
return DeviceMgtUserDataHolder.getInstance().getUserManager().getUsersForTenant(tenantId);
|
return DeviceMgtUserDataHolder.getInstance().getUserManager().getUsersForTenant(tenantId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override public User getUser(String username, int tenantId) throws UserManagementException {
|
||||||
|
return DeviceMgtUserDataHolder.getInstance().getUserManager().getUser(username, tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user