| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.google.inject.Inject; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | |
| | | import com.gitblit.models.TeamModel; |
| | | import com.gitblit.models.UserModel; |
| | | import com.gitblit.utils.StringUtils; |
| | | import com.google.inject.Inject; |
| | | import com.google.inject.Singleton; |
| | | |
| | | /** |
| | | * The user manager manages persistence and retrieval of users and teams. |
| | |
| | | * @author James Moger |
| | | * |
| | | */ |
| | | @Singleton |
| | | public class UserManager implements IUserManager { |
| | | |
| | | private final Logger logger = LoggerFactory.getLogger(getClass()); |
| | |
| | | * @param userService |
| | | */ |
| | | public void setUserService(IUserService userService) { |
| | | logger.info(userService.toString()); |
| | | this.userService = userService; |
| | | this.userService.setup(runtimeManager); |
| | | logger.info(userService.toString()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | // check to see if this "file" is a custom user service class |
| | | Class<?> realmClass = Class.forName(realm); |
| | | service = (IUserService) realmClass.newInstance(); |
| | | } catch (Throwable t) { |
| | | } catch (ClassNotFoundException t) { |
| | | // typical file path configuration |
| | | File realmFile = runtimeManager.getFileOrFolder(Keys.realm.userService, "${baseFolder}/users.conf"); |
| | | service = createUserService(realmFile); |
| | | } catch (InstantiationException | IllegalAccessException e) { |
| | | logger.error("failed to instantiate user service {}: {}", realm, e.getMessage()); |
| | | } |
| | | } |
| | | setUserService(service); |