Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Duniter v2S
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
rust
Duniter v2S
Commits
b8b406c5
Commit
b8b406c5
authored
2 years ago
by
Hugo Trentesaux
Browse files
Options
Downloads
Patches
Plain Diff
wip replace identity confirm check
parent
9e8a98cc
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
pallets/duniter-wot/src/lib.rs
+7
-5
7 additions, 5 deletions
pallets/duniter-wot/src/lib.rs
pallets/identity/src/lib.rs
+1
-5
1 addition, 5 deletions
pallets/identity/src/lib.rs
pallets/identity/src/traits.rs
+4
-4
4 additions, 4 deletions
pallets/identity/src/traits.rs
with
12 additions
and
14 deletions
pallets/duniter-wot/src/lib.rs
+
7
−
5
View file @
b8b406c5
...
@@ -136,16 +136,18 @@ where
...
@@ -136,16 +136,18 @@ where
Ok
(())
Ok
(())
}
}
}
}
fn
c
an
_confirm_identity
(
idty_index
:
IdtyIndex
)
->
bool
{
fn
c
heck
_confirm_identity
(
idty_index
:
IdtyIndex
)
->
Result
<
(),
DispatchError
>
{
if
!
T
::
IsSubWot
::
get
()
{
if
!
T
::
IsSubWot
::
get
()
{
pallet_membership
::
Pallet
::
<
T
,
I
>
::
force_request_membership
(
match
pallet_membership
::
Pallet
::
<
T
,
I
>
::
force_request_membership
(
RawOrigin
::
Root
.into
(),
RawOrigin
::
Root
.into
(),
idty_index
,
idty_index
,
Default
::
default
(),
Default
::
default
(),
)
)
{
.is_ok
()
Ok
(
_
)
=>
Ok
(()),
Err
(
e
)
=>
Err
(
e
.error
),
// return error from inner function
}
}
else
{
}
else
{
true
Ok
(())
}
}
}
}
fn
can_validate_identity
(
idty_index
:
IdtyIndex
)
->
bool
{
fn
can_validate_identity
(
idty_index
:
IdtyIndex
)
->
bool
{
...
...
This diff is collapsed.
Click to expand it.
pallets/identity/src/lib.rs
+
1
−
5
View file @
b8b406c5
...
@@ -340,9 +340,7 @@ pub mod pallet {
...
@@ -340,9 +340,7 @@ pub mod pallet {
if
<
IdentitiesNames
<
T
>>
::
contains_key
(
&
idty_name
)
{
if
<
IdentitiesNames
<
T
>>
::
contains_key
(
&
idty_name
)
{
return
Err
(
Error
::
<
T
>
::
IdtyNameAlreadyExist
.into
());
return
Err
(
Error
::
<
T
>
::
IdtyNameAlreadyExist
.into
());
}
}
if
!
T
::
EnsureIdtyCallAllowed
::
can_confirm_identity
(
idty_index
)
{
T
::
EnsureIdtyCallAllowed
::
check_confirm_identity
(
idty_index
)
?
;
return
Err
(
Error
::
<
T
>
::
NotAllowedToConfirmIdty
.into
());
}
// Apply phase //
// Apply phase //
idty_value
.status
=
IdtyStatus
::
ConfirmedByOwner
;
idty_value
.status
=
IdtyStatus
::
ConfirmedByOwner
;
...
@@ -610,8 +608,6 @@ pub mod pallet {
...
@@ -610,8 +608,6 @@ pub mod pallet {
InvalidRevocationSig
,
InvalidRevocationSig
,
/// Identity not allowed to change address
/// Identity not allowed to change address
NotAllowedToChangeIdtyAddress
,
NotAllowedToChangeIdtyAddress
,
/// Not allowed to confirm identity
NotAllowedToConfirmIdty
,
/// Not allowed to remove identity
/// Not allowed to remove identity
NotAllowedToRemoveIdty
,
NotAllowedToRemoveIdty
,
/// Not allowed to validate identity
/// Not allowed to validate identity
...
...
This diff is collapsed.
Click to expand it.
pallets/identity/src/traits.rs
+
4
−
4
View file @
b8b406c5
...
@@ -21,7 +21,7 @@ use sp_runtime::traits::Saturating;
...
@@ -21,7 +21,7 @@ use sp_runtime::traits::Saturating;
pub
trait
EnsureIdtyCallAllowed
<
T
:
Config
>
{
pub
trait
EnsureIdtyCallAllowed
<
T
:
Config
>
{
fn
check_create_identity
(
creator
:
T
::
IdtyIndex
)
->
Result
<
(),
DispatchError
>
;
fn
check_create_identity
(
creator
:
T
::
IdtyIndex
)
->
Result
<
(),
DispatchError
>
;
fn
c
an
_confirm_identity
(
idty_index
:
T
::
IdtyIndex
)
->
bool
;
fn
c
heck
_confirm_identity
(
idty_index
:
T
::
IdtyIndex
)
->
Result
<
(),
DispatchError
>
;
fn
can_validate_identity
(
idty_index
:
T
::
IdtyIndex
)
->
bool
;
fn
can_validate_identity
(
idty_index
:
T
::
IdtyIndex
)
->
bool
;
fn
can_change_identity_address
(
idty_index
:
T
::
IdtyIndex
)
->
bool
;
fn
can_change_identity_address
(
idty_index
:
T
::
IdtyIndex
)
->
bool
;
fn
can_remove_identity
(
idty_index
:
T
::
IdtyIndex
)
->
bool
;
fn
can_remove_identity
(
idty_index
:
T
::
IdtyIndex
)
->
bool
;
...
@@ -34,9 +34,9 @@ impl<T: Config> EnsureIdtyCallAllowed<T> for Tuple {
...
@@ -34,9 +34,9 @@ impl<T: Config> EnsureIdtyCallAllowed<T> for Tuple {
for_tuples!
(
#
(
Tuple
::
check_create_identity
(
creator
)
?
;
)
*
);
for_tuples!
(
#
(
Tuple
::
check_create_identity
(
creator
)
?
;
)
*
);
Ok
(())
Ok
(())
}
}
fn
c
an
_confirm_identity
(
idty_index
:
T
::
IdtyIndex
)
->
bool
{
fn
c
heck
_confirm_identity
(
idty_index
:
T
::
IdtyIndex
)
->
Result
<
(),
DispatchError
>
{
for_tuples!
(
#
(
if
!
Tuple
::
c
an
_confirm_identity
(
idty_index
)
{
return
false
;
}
)
*
);
for_tuples!
(
#
(
Tuple
::
c
heck
_confirm_identity
(
idty_index
)
?
;
)
*
);
true
Ok
(())
}
}
fn
can_validate_identity
(
idty_index
:
T
::
IdtyIndex
)
->
bool
{
fn
can_validate_identity
(
idty_index
:
T
::
IdtyIndex
)
->
bool
{
for_tuples!
(
#
(
if
!
Tuple
::
can_validate_identity
(
idty_index
)
{
return
false
;
}
)
*
);
for_tuples!
(
#
(
if
!
Tuple
::
can_validate_identity
(
idty_index
)
{
return
false
;
}
)
*
);
...
...
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