Exemplo n.º 1
0
        public bool UninstallPlugin(string uid, out string error)
        {
            var entity = PluginInstallationsRepository.Get(x => x.UId == uid && x.IsActive);

            if (entity == null)
            {
                error = "entity not found";
                return(false);
            }

            entity.UpdatePluginStatus(false);

            PluginInstallationsRepository.Update(entity);
            return(PluginInstallationsRepository.UnitOfWork.CommitAndRefreshChanges(out error));
        }
Exemplo n.º 2
0
        public bool SavePluginInstallaltion(PluginInstallationDTO token, out string error)
        {
            error = string.Empty;

            var entity = PluginInstallationsRepository.Get(x => x.UId == token.Uid && x.IsActive);

            if (entity != null)
            {
                return(true);
            }

            entity          = token.Token2PluginInstallationEntity();
            entity.IsActive = true;

            PluginInstallationsRepository.Add(entity);

            return(PluginInstallationsRepository.UnitOfWork.CommitAndRefreshChanges(out error));
        }
Exemplo n.º 3
0
        public PluginInstallationDTO GetPluginInstallationDto(string uid, out string error)
        {
            error = string.Empty;
            try
            {
                var entity = PluginInstallationsRepository.Get(x => x.UId == uid && x.IsActive);

                if (entity != null)
                {
                    return(entity.Entity2PluginInstallationDto());
                }

                error = "entity not found";
                return(null);
            }
            catch (Exception ex)
            {
                error = FormatError(ex);
                Logger.Error("Get Plugin dto::" + uid, ex, CommonEnums.LoggerObjectTypes.Plugin);
                return(null);
            }
        }
Exemplo n.º 4
0
        public bool VerifyPluginOwner(string uid, out string error)
        {
            error = string.Empty;
            try
            {
                var entity = PluginInstallationsRepository.Get(x => x.UId == uid && x.IsActive);

                if (entity == null)
                {
                    error = "Plugin installation record missing";
                    return(false);
                }

                if (entity.UserId == null)
                {
                    entity.UserId     = CurrentUserId;
                    entity.UpdateDate = DateTime.Now;

                    return(PluginInstallationsRepository.UnitOfWork.CommitAndRefreshChanges(out error));
                }

                if (entity.UserId == CurrentUserId)
                {
                    return(true);
                }

                error = "You are attempting to login with an LFE account that is not connected to this application. Click here to connect with the LFE account associated with this plugin";
                return(false);
            }
            catch (Exception ex)
            {
                error = FormatError(ex);
                Logger.Error("Save Plugin owner::" + uid, ex, CommonEnums.LoggerObjectTypes.Plugin);
                return(false);
            }
        }