-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
display error if token with same application name exists #27587
Closed
Closed
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e6bde0f
create authtoken table through migrations, added combined unique cons…
4f3f110
removed unnecessary todo
29ecc6d
catch unique constraint violation exception and return an error respo…
d05245e
display error message if response code is 409 (conflict)
f7d8e52
used doctrine class constants for types, removed default and notnull …
19431e8
uid, login_name and token should be strings because the length is fixed
d4eb109
type should be a smallint and added missing primary key
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<?php | ||
namespace OC\Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use OCP\Migration\ISchemaMigration; | ||
|
||
/** | ||
* Auto-generated migration step: Please modify to your needs! | ||
*/ | ||
class Version20170406110401 implements ISchemaMigration { | ||
|
||
/** | ||
* @param Schema $schema | ||
* @param array $options | ||
*/ | ||
public function changeSchema(Schema $schema, array $options) { | ||
$tableName = $options['tablePrefix'] . 'authtoken'; | ||
|
||
if (!$schema->hasTable($tableName)) { | ||
|
||
$table = $schema->createTable($tableName); | ||
|
||
$table->addColumn('id', 'integer', [ | ||
'default' => 0, | ||
'notnull' => true, | ||
'autoincrement' => 1, | ||
'unsigned' => true, | ||
'length' => 4 | ||
]); | ||
|
||
$table->addColumn('uid', 'text', [ | ||
'default' => '', | ||
'notnull' => true, | ||
'length' => 64 | ||
]); | ||
|
||
$table->addColumn('login_name', 'text', [ | ||
'default' => '', | ||
'notnull' => true, | ||
'length' => 64 | ||
]); | ||
|
||
$table->addColumn('password', 'text', [ | ||
'default' => '', | ||
'notnull' => false | ||
]); | ||
|
||
$table->addColumn('name', 'text', [ | ||
'default' => '', | ||
'notnull' => true | ||
]); | ||
|
||
$table->addColumn('token', 'text', [ | ||
'default' => '', | ||
'notnull' => true, | ||
'length' => 200 | ||
]); | ||
|
||
$table->addColumn('type', 'integer', [ | ||
'default' => 0, | ||
'notnull' => true, | ||
'unsigned' => true, | ||
'length' => 2 | ||
]); | ||
|
||
$table->addColumn('last_activity', 'integer', [ | ||
'default' => 0, | ||
'notnull' => true, | ||
'unsigned' => true, | ||
'length' => 4 | ||
]); | ||
|
||
$table->addColumn('last_check', 'integer', [ | ||
'default' => 0, | ||
'notnull' => true, | ||
'unsigned' => true, | ||
'length' => 4 | ||
]); | ||
|
||
$table->addIndex( | ||
['token'], | ||
'authtoken_token_index', | ||
[], | ||
[ | ||
'unique' => true, | ||
'order' => 'asc' | ||
] | ||
); | ||
|
||
$table->addIndex( | ||
['last_activity'], | ||
'authtoken_last_activity_index', | ||
[], | ||
[ | ||
'order' => 'asc' | ||
] | ||
); | ||
|
||
$table->addUniqueIndex( | ||
['uid', 'name'], | ||
'uid_name_index' | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
namespace OC\Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use OCP\Migration\ISchemaMigration; | ||
|
||
/** | ||
* Auto-generated migration step: Please modify to your needs! | ||
*/ | ||
class Version20170406131248 implements ISchemaMigration { | ||
|
||
/** | ||
* @param Schema $schema | ||
* @param array $options | ||
*/ | ||
public function changeSchema(Schema $schema, array $options) { | ||
$tableName = $options['tablePrefix'] . 'authtoken'; | ||
$table = $schema->getTable($tableName); | ||
|
||
if (!$table->hasIndex('uid_name_index')) { | ||
$table->addUniqueIndex( | ||
['uid', 'name'], | ||
'uid_name_index' | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DeepDiver1975 can you get me the translations for that string?
Not sure if i will get translations by putting them into transifex myself (not under the owncloud organisation).