Comparar commits
8 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 1c92d68fe1 | |||
| d983f45eab | |||
| 944de6a3d5 | |||
| ebb9cc786f | |||
| f01788ae78 | |||
| 4de09e85e3 | |||
| cc11833d8d | |||
| 0f58431746 |
@@ -61,7 +61,7 @@ our $infoCnt = 1;
|
||||
our %config;
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw( initTesting createRemoteDir createLocalDir cleanup csync
|
||||
@EXPORT = qw( initTesting createRemoteDir removeRemoteDir createLocalDir cleanup csync
|
||||
assertLocalDirs assertLocalAndRemoteDir glob_put put_to_dir
|
||||
putToDirLWP localDir remoteDir localCleanup createLocalFile md5OfFile
|
||||
remoteCleanup server initLocalDir initRemoteDir moveRemoteFile
|
||||
@@ -181,6 +181,32 @@ sub initLocalDir
|
||||
mkdir ($localDir, 0777 );
|
||||
}
|
||||
|
||||
sub removeRemoteDir($;$)
|
||||
{
|
||||
my ($dir, $optionsRef) = @_;
|
||||
|
||||
my $url = testDirUrl() . $dir;
|
||||
|
||||
if( $optionsRef && $optionsRef->{user} && $optionsRef->{passwd} ) {
|
||||
$d->credentials( -url=> $owncloud, -realm=>"ownCloud",
|
||||
-user=> $optionsRef->{user},
|
||||
-pass=> $optionsRef->{passwd} );
|
||||
if( $optionsRef->{url} ) {
|
||||
$url = $optionsRef->{url} . $dir;
|
||||
}
|
||||
}
|
||||
|
||||
$d->open( $owncloud );
|
||||
print $d->message . "\n";
|
||||
|
||||
my $re = $d->delete( $url );
|
||||
if( $re == 0 ) {
|
||||
print "Failed to remove directory <$url>:" . $d->message() ."\n";
|
||||
}
|
||||
|
||||
return $re;
|
||||
}
|
||||
|
||||
sub createRemoteDir(;$$)
|
||||
{
|
||||
my ($dir, $optionsRef) = @_;
|
||||
@@ -201,7 +227,7 @@ sub createRemoteDir(;$$)
|
||||
|
||||
my $re = $d->mkcol( $url );
|
||||
if( $re == 0 ) {
|
||||
print "Failed to create directory <$url>: $d->message() \n";
|
||||
print "Failed to create directory <$url>: " . $d->message() ."\n";
|
||||
exit 1;
|
||||
}
|
||||
$d->open( $url );
|
||||
|
||||
@@ -35,6 +35,13 @@ print "Hello, this is t5, a tester for syncing of files in Shares\n";
|
||||
initTesting();
|
||||
|
||||
my $share_dir = "share_source";
|
||||
my $sharee = { user => configValue('share_user'),
|
||||
passwd => configValue('share_passwd'),
|
||||
url => server() };
|
||||
|
||||
# first remove a possibly left over share dir.
|
||||
printInfo( "Remove possibly left over share dir" );
|
||||
removeRemoteDir( $share_dir, $sharee );
|
||||
|
||||
printInfo( "Create a share." );
|
||||
my $shareId = createShare( $share_dir, 31 );
|
||||
@@ -42,25 +49,28 @@ print "Created share with id <$shareId>\n";
|
||||
|
||||
assert( $shareId > 0 );
|
||||
|
||||
my $sharee = { user => configValue('share_user'),
|
||||
passwd => configValue('share_passwd'),
|
||||
url => server() };
|
||||
if( $ENV{SERVER_VERSION} eq "owncloud7" ) {
|
||||
print "This test does not make sense for ownCloud7, leaving for good!\n\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
# put a couple of files into the shared directory in the sharer account
|
||||
glob_put( 'sharing/*', $share_dir, $sharee);
|
||||
|
||||
# now user kf has a new directory in shared.
|
||||
if( $ENV{SERVER_VERSION} eq "owncloud6" ) {
|
||||
# now user kf has a new directory in shared.
|
||||
|
||||
# call csync, sync local t1 to remote t1
|
||||
printInfo("Initial sync, sync stuff down.");
|
||||
csync( server()."Shared" );
|
||||
assertLocalAndRemoteDir( 'Shared', 0, server() );
|
||||
|
||||
# Local file to a read/write share should be synced up
|
||||
printInfo("Put a file into the share.");
|
||||
createLocalFile( localDir(). $share_dir . "/foobar.txt", 8094 );
|
||||
csync( server()."Shared" );
|
||||
assertLocalAndRemoteDir( 'Shared', 0, server() );
|
||||
# call csync, sync local t1 to remote t1
|
||||
printInfo("Initial sync, sync stuff down.");
|
||||
csync( server()."Shared" );
|
||||
assertLocalAndRemoteDir( 'Shared', 0, server() );
|
||||
|
||||
# Local file to a read/write share should be synced up
|
||||
printInfo("Put a file into the share.");
|
||||
createLocalFile( localDir(). $share_dir . "/foobar.txt", 8094 );
|
||||
csync( server()."Shared" );
|
||||
assertLocalAndRemoteDir( 'Shared', 0, server() );
|
||||
}
|
||||
|
||||
printInfo("Remove a Share.");
|
||||
removeShare($shareId, $share_dir);
|
||||
|
||||
@@ -241,7 +241,19 @@ void ShibbolethCredentials::persist(Account* account)
|
||||
void ShibbolethCredentials::invalidateToken(Account *account)
|
||||
{
|
||||
CookieJar *jar = static_cast<CookieJar*>(account->networkAccessManager()->cookieJar());
|
||||
jar->deleteCookie(_shibCookie);
|
||||
|
||||
// Remove the _shibCookie
|
||||
QList<QNetworkCookie> cookies = jar->allCookies();
|
||||
for (QList<QNetworkCookie>::iterator it = cookies.begin(); it != cookies.end(); ) {
|
||||
if (it->name() == _shibCookie.name()) {
|
||||
it = cookies.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
jar->setAllCookies(cookies);
|
||||
|
||||
// Clear all other temporary cookies
|
||||
jar->clearSessionCookies();
|
||||
removeShibCookie(account);
|
||||
_shibCookie = QNetworkCookie();
|
||||
|
||||
@@ -91,27 +91,11 @@ QList<QNetworkCookie> CookieJar::cookiesForUrl(const QUrl &url) const
|
||||
return cookies;
|
||||
}
|
||||
|
||||
bool CookieJar::deleteCookie(const QNetworkCookie &delCookie)
|
||||
{
|
||||
QList<QNetworkCookie> cookies = allCookies();
|
||||
bool removeSucceeded = false;
|
||||
foreach(const QNetworkCookie &cookie, cookies) {
|
||||
// ### cookies are not identical in attriutes, why?
|
||||
if (cookie.name() == delCookie.name()) {
|
||||
cookies.removeOne(cookie);
|
||||
removeSucceeded = true;
|
||||
}
|
||||
}
|
||||
setAllCookies(cookies);
|
||||
return removeSucceeded;
|
||||
}
|
||||
|
||||
void CookieJar::clearSessionCookies()
|
||||
{
|
||||
setAllCookies(removeExpired(allCookies()));
|
||||
}
|
||||
|
||||
|
||||
void CookieJar::save()
|
||||
{
|
||||
QFile file;
|
||||
|
||||
@@ -29,9 +29,11 @@ public:
|
||||
bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url);
|
||||
QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const;
|
||||
|
||||
virtual bool deleteCookie(const QNetworkCookie & cookie);
|
||||
void clearSessionCookies();
|
||||
|
||||
using QNetworkCookieJar::setAllCookies;
|
||||
using QNetworkCookieJar::allCookies;
|
||||
|
||||
signals:
|
||||
void newCookiesForUrl(const QList<QNetworkCookie>& cookieList, const QUrl& url);
|
||||
private:
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário