Exemple #1
0
 public override void TaskComplete(Tasks.Base sender, ICommandReply reply)
 {
     Tasks.DownloadUser task = (Tasks.DownloadUser)sender;
     Session         = _sessionMgr.AuthenticateUser(_db, task.User, _password);
     IsAuthenticated = (Session != null);
     TriggerOnComplete(null, new Tuple <Security.Session, bool>(Session, IsAuthenticated));
 }
        public override void TaskComplete(Tasks.Base sender, ICommandReply reply)
        {
            Type t = sender.GetType();

            if (t == typeof(Tasks.DownloadGlobalPermissions))
            {
                Tasks.DownloadGlobalPermissions task = (Tasks.DownloadGlobalPermissions)sender;
                _gur = task.GlobalUsageRights;
                RunTaskProcess(new Tasks.CheckGlobalPermissions(_db, _gur, _requestingPartyType,
                                                                _session, Security.Authorization.GlobalPermissionType.CreateResource, _sendTimeout, _receiveTimeout,
                                                                _sendBufferSize, _receiveBufferSize));
            }
            else if (t == typeof(Tasks.CheckGlobalPermissions))
            {
                Tasks.CheckGlobalPermissions task = (Tasks.CheckGlobalPermissions)sender;
                if (!task.IsAuthorized)
                {
                    TriggerOnAuthorizationDenied(task);
                    return;
                }
                RunTaskProcess(new Tasks.DownloadUser(_db, User.Username, _sendTimeout, _receiveTimeout,
                                                      _sendBufferSize, _receiveBufferSize));
            }
            else if (t == typeof(Tasks.DownloadUser))
            {
                Tasks.DownloadUser task = (Tasks.DownloadUser)sender;
                User = task.User;
                TriggerOnComplete(reply, User);
            }
            else
            {
                TriggerOnError(sender, reply.ToString(), null);
            }
        }