Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Vaultwarden
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Vaultwarden
Commits
09053556
Commit
09053556
authored
6 years ago
by
Daniel García
Browse files
Options
Downloads
Patches
Plain Diff
Fix wrong case in import struct, invite collections and user Uri back-compat
parent
f24e754f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/api/core/ciphers.rs
+3
-3
3 additions, 3 deletions
src/api/core/ciphers.rs
src/api/core/organizations.rs
+7
-7
7 additions, 7 deletions
src/api/core/organizations.rs
src/db/models/cipher.rs
+1
-1
1 addition, 1 deletion
src/db/models/cipher.rs
with
11 additions
and
11 deletions
src/api/core/ciphers.rs
+
3
−
3
View file @
09053556
...
...
@@ -206,9 +206,9 @@ struct ImportData {
#[allow(non_snake_case)]
struct
RelationsData
{
// Cipher id
k
ey
:
usize
,
K
ey
:
usize
,
// Folder id
v
alue
:
usize
,
V
alue
:
usize
,
}
...
...
@@ -228,7 +228,7 @@ fn post_ciphers_import(data: JsonUpcase<ImportData>, headers: Headers, conn: DbC
let
mut
relations_map
=
HashMap
::
new
();
for
relation
in
data
.FolderRelationships
{
relations_map
.insert
(
relation
.
k
ey
,
relation
.
v
alue
);
relations_map
.insert
(
relation
.
K
ey
,
relation
.
V
alue
);
}
// Read and create the ciphers
...
...
This diff is collapsed.
Click to expand it.
src/api/core/organizations.rs
+
7
−
7
View file @
09053556
...
...
@@ -288,8 +288,8 @@ fn get_org_users(org_id: String, headers: AdminHeaders, conn: DbConn) -> JsonRes
#[derive(Deserialize)]
#[allow(non_snake_case)]
struct
CollectionData
{
i
d
:
String
,
r
eadOnly
:
bool
,
I
d
:
String
,
R
eadOnly
:
bool
,
}
#[derive(Deserialize)]
...
...
@@ -331,10 +331,10 @@ fn send_invite(org_id: String, data: JsonUpcase<InviteData>, headers: AdminHeade
// If no accessAll, add the collections received
if
!
access_all
{
for
col
in
&
data
.Collections
{
match
Collection
::
find_by_uuid_and_org
(
&
col
.
i
d
,
&
org_id
,
&
conn
)
{
match
Collection
::
find_by_uuid_and_org
(
&
col
.
I
d
,
&
org_id
,
&
conn
)
{
None
=>
err!
(
"Collection not found in Organization"
),
Some
(
collection
)
=>
{
if
CollectionUser
::
save
(
&
user
.uuid
,
&
collection
.uuid
,
col
.
r
eadOnly
,
&
conn
)
.is_err
()
{
if
CollectionUser
::
save
(
&
user
.uuid
,
&
collection
.uuid
,
col
.
R
eadOnly
,
&
conn
)
.is_err
()
{
err!
(
"Failed saving collection access for user"
)
}
}
...
...
@@ -373,7 +373,7 @@ fn confirm_invite(org_id: String, user_id: String, data: JsonUpcase<Value>, head
}
user_to_confirm
.status
=
UserOrgStatus
::
Confirmed
as
i32
;
user_to_confirm
.key
=
match
data
[
"
k
ey"
]
.as_str
()
{
user_to_confirm
.key
=
match
data
[
"
K
ey"
]
.as_str
()
{
Some
(
key
)
=>
key
.to_string
(),
None
=>
err!
(
"Invalid key provided"
)
};
...
...
@@ -455,10 +455,10 @@ fn edit_user(org_id: String, user_id: String, data: JsonUpcase<EditUserData>, he
// If no accessAll, add the collections received
if
!
data
.AccessAll
{
for
col
in
&
data
.Collections
{
match
Collection
::
find_by_uuid_and_org
(
&
col
.
i
d
,
&
org_id
,
&
conn
)
{
match
Collection
::
find_by_uuid_and_org
(
&
col
.
I
d
,
&
org_id
,
&
conn
)
{
None
=>
err!
(
"Collection not found in Organization"
),
Some
(
collection
)
=>
{
if
CollectionUser
::
save
(
&
user_to_edit
.user_uuid
,
&
collection
.uuid
,
col
.
r
eadOnly
,
&
conn
)
.is_err
()
{
if
CollectionUser
::
save
(
&
user_to_edit
.user_uuid
,
&
collection
.uuid
,
col
.
R
eadOnly
,
&
conn
)
.is_err
()
{
err!
(
"Failed saving collection access for user"
)
}
}
...
...
This diff is collapsed.
Click to expand it.
src/db/models/cipher.rs
+
1
−
1
View file @
09053556
...
...
@@ -84,7 +84,7 @@ impl Cipher {
// To remove backwards compatibility, just remove this entire section
// and remove the compat code from ciphers::update_cipher_from_data
if
self
.type_
==
1
&&
data_json
[
"Uris"
]
.is_array
()
{
let
uri
=
data_json
[
"Uris"
][
0
][
"
u
ri"
]
.clone
();
let
uri
=
data_json
[
"Uris"
][
0
][
"
U
ri"
]
.clone
();
data_json
[
"Uri"
]
=
uri
;
}
// TODO: ******* Backwards compat end **********
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment