Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Cesium
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bpresles
Cesium
Commits
a6725601
Commit
a6725601
authored
7 years ago
by
Benoit Lavenier
Browse files
Options
Downloads
Patches
Plain Diff
[fix] sending invitation not allow for non-member - fix #561
parent
00a7b601
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+1
-1
1 addition, 1 deletion
README.md
www/plugins/es/js/controllers/wot-controllers.js
+78
-68
78 additions, 68 deletions
www/plugins/es/js/controllers/wot-controllers.js
with
79 additions
and
69 deletions
README.md
+
1
−
1
View file @
a6725601
...
...
@@ -38,7 +38,7 @@ npm start
```
Answer asked questions.
Your
c
esium instance is now reacheable on :
[
http://localhost:8100/
](
http://localhost:8100/
)
or an other ip if your listen on an other interface.
Your
C
esium instance is now reacheable on :
[
http://localhost:8100/
](
http://localhost:8100/
)
or an other ip if your listen on an other interface.
#### Installation script
...
...
This diff is collapsed.
Click to expand it.
www/plugins/es/js/controllers/wot-controllers.js
+
78
−
68
View file @
a6725601
...
...
@@ -82,7 +82,7 @@ function ESWotLookupExtendController($scope, $controller, $state) {
};
}
function
ESWotIdentityViewController
(
$scope
,
$ionicPopover
,
$q
,
UIUtils
,
Modals
,
esSettings
,
PluginService
,
function
ESWotIdentityViewController
(
$scope
,
$ionicPopover
,
$q
,
UIUtils
,
Modals
,
esSettings
,
PluginService
,
csWallet
,
esModals
,
esHttp
,
esWallet
,
esInvitation
)
{
'
ngInject
'
;
...
...
@@ -128,14 +128,17 @@ function ESWotIdentityViewController($scope, $ionicPopover, $q, UIUtils, Modals,
$scope
.
hideCertificationActionsPopover
();
var
walletData
;
var
identities
;
return
$scope
.
load
Wallet
({
minData
:
true
})
.
then
(
function
(
d
ata
)
{
return
cs
Wallet
.
auth
({
minData
:
true
})
.
then
(
function
(
walletD
ata
)
{
UIUtils
.
loading
.
hide
();
walletData
=
data
;
// Not allow for non-member - issue #561
if
(
!
walletData
.
isMember
)
{
return
UIUtils
.
alert
.
error
(
'
ERROR.ONLY_MEMBER_CAN_EXECUTE_THIS_ACTION
'
);
}
return
Modals
.
showWotLookup
({
allowMultiple
:
true
,
enableFilter
:
true
,
...
...
@@ -143,56 +146,58 @@ function ESWotIdentityViewController($scope, $ionicPopover, $q, UIUtils, Modals,
help
:
'
WOT.SUGGEST_CERTIFICATIONS_MODAL.HELP
'
,
okText
:
'
COMMON.BTN_NEXT
'
,
okType
:
'
button-positive
'
});
})
.
then
(
function
(
res
)
{
if
(
!
res
||
!
res
.
length
)
return
;
// user cancelled
identities
=
res
;
})
.
then
(
function
(
res
)
{
if
(
!
res
||
!
res
.
length
)
return
;
// user cancelled
identities
=
res
;
return
$q
.
all
([
return
$q
.
all
([
// Get keypair only once (if not done here, certification.send() with compute it many times)
esWallet
.
box
.
getKeypair
(
walletData
.
keypair
),
// Ask confirmation
UIUtils
.
alert
.
confirm
(
'
WOT.CONFIRM.SUGGEST_CERTIFICATIONS
'
,
undefined
,
{
okText
:
'
COMMON.BTN_SEND
'
})
])
.
then
(
function
(
res
)
{
if
(
!
res
)
return
;
var
keypair
=
res
[
0
];
var
confirm
=
res
[
1
];
if
(
!
confirm
)
return
;
var
time
=
esHttp
.
date
.
now
();
// use same date for each invitation
return
$q
.
all
(
identities
.
reduce
(
function
(
res
,
identity
){
return
res
.
concat
(
esInvitation
.
send
({
issuer
:
walletData
.
pubkey
,
recipient
:
$scope
.
formData
.
pubkey
,
time
:
time
,
content
:
[
identity
.
uid
,
identity
.
pubkey
].
join
(
'
-
'
)
},
keypair
,
'
certification
'
)
);
},
[])
);
})
.
then
(
function
()
{
UIUtils
.
toast
.
show
(
'
INVITATION.INFO.INVITATION_SENT
'
);
})
.
catch
(
UIUtils
.
onError
(
'
INVITATION.ERROR.SEND_INVITATION_FAILED
'
));
})
;
.
then
(
function
(
res
)
{
if
(
!
res
)
return
;
var
keypair
=
res
[
0
];
var
confirm
=
res
[
1
];
if
(
!
confirm
)
return
;
var
time
=
esHttp
.
date
.
now
();
// use same date for each invitation
return
$q
.
all
(
identities
.
reduce
(
function
(
res
,
identity
){
return
res
.
concat
(
esInvitation
.
send
({
issuer
:
walletData
.
pubkey
,
recipient
:
$scope
.
formData
.
pubkey
,
time
:
time
,
content
:
[
identity
.
uid
,
identity
.
pubkey
].
join
(
'
-
'
)
},
keypair
,
'
certification
'
)
);
},
[])
);
})
.
then
(
function
()
{
UIUtils
.
toast
.
show
(
'
INVITATION.INFO.INVITATION_SENT
'
);
})
.
catch
(
UIUtils
.
onError
(
'
INVITATION.ERROR.SEND_INVITATION_FAILED
'
));
})
;
});
};
$scope
.
showAskCertificationModal
=
function
()
{
$scope
.
hideCertificationActionsPopover
();
var
walletData
;
var
identities
;
return
$scope
.
load
Wallet
({
minData
:
true
})
.
then
(
function
(
d
ata
)
{
return
cs
Wallet
.
auth
({
minData
:
true
})
.
then
(
function
(
walletD
ata
)
{
UIUtils
.
loading
.
hide
();
walletData
=
data
;
// Not allow for non-member - issue #561
if
(
!
walletData
.
isMember
)
{
return
UIUtils
.
alert
.
error
(
'
ERROR.ONLY_MEMBER_CAN_EXECUTE_THIS_ACTION
'
);
}
return
Modals
.
showWotLookup
({
allowMultiple
:
true
,
...
...
@@ -201,38 +206,38 @@ function ESWotIdentityViewController($scope, $ionicPopover, $q, UIUtils, Modals,
help
:
'
WOT.ASK_CERTIFICATIONS_MODAL.HELP
'
,
okText
:
'
COMMON.BTN_NEXT
'
,
okType
:
'
button-positive
'
});
})
.
then
(
function
(
res
)
{
if
(
!
res
||
!
res
.
length
)
return
;
// user cancelled
identities
=
res
;
})
.
then
(
function
(
res
)
{
if
(
!
res
||
!
res
.
length
)
return
;
// user cancelled
identities
=
res
;
return
$q
.
all
([
return
$q
.
all
([
// Get keypair only once (if not done here, certification.send() with compute it many times)
esWallet
.
box
.
getKeypair
(
walletData
.
keypair
),
// Ask confirmation
UIUtils
.
alert
.
confirm
(
'
WOT.CONFIRM.ASK_CERTIFICATIONS
'
,
undefined
,
{
okText
:
'
COMMON.BTN_SEND
'
})
])
.
then
(
function
(
res
)
{
if
(
!
res
)
return
;
var
keypair
=
res
[
0
];
var
confirm
=
res
[
1
];
if
(
!
confirm
)
return
;
var
time
=
esHttp
.
date
.
now
();
// use same date for each invitation
return
$q
.
all
(
identities
.
reduce
(
function
(
res
,
identity
){
return
res
.
concat
(
esInvitation
.
send
({
issuer
:
walletData
.
pubkey
,
recipient
:
identity
.
pubkey
,
time
:
time
,
content
:
[
walletData
.
uid
,
walletData
.
pubkey
].
join
(
'
-
'
)
},
keypair
,
'
certification
'
)
);
},
[]))
.
then
(
function
()
{
UIUtils
.
toast
.
show
(
'
INVITATION.INFO.INVITATION_SENT
'
);
})
.
catch
(
UIUtils
.
onError
(
'
INVITATION.ERROR.SEND_INVITATION_FAILED
'
));
.
then
(
function
(
res
)
{
if
(
!
res
)
return
;
var
keypair
=
res
[
0
];
var
confirm
=
res
[
1
];
if
(
!
confirm
)
return
;
var
time
=
esHttp
.
date
.
now
();
// use same date for each invitation
return
$q
.
all
(
identities
.
reduce
(
function
(
res
,
identity
){
return
res
.
concat
(
esInvitation
.
send
({
issuer
:
walletData
.
pubkey
,
recipient
:
identity
.
pubkey
,
time
:
time
,
content
:
[
walletData
.
uid
,
walletData
.
pubkey
].
join
(
'
-
'
)
},
keypair
,
'
certification
'
)
);
},
[]))
.
then
(
function
()
{
UIUtils
.
toast
.
show
(
'
INVITATION.INFO.INVITATION_SENT
'
);
})
.
catch
(
UIUtils
.
onError
(
'
INVITATION.ERROR.SEND_INVITATION_FAILED
'
));
});
});
});
};
...
...
@@ -240,10 +245,15 @@ function ESWotIdentityViewController($scope, $ionicPopover, $q, UIUtils, Modals,
$scope
.
askCertification
=
function
()
{
$scope
.
hideCertificationActionsPopover
();
$scope
.
load
Wallet
({
minData
:
true
})
return
cs
Wallet
.
auth
({
minData
:
true
})
.
then
(
function
(
walletData
)
{
UIUtils
.
loading
.
hide
();
// Not allow for non-member - issue #561
if
(
!
walletData
.
isMember
)
{
return
UIUtils
.
alert
.
error
(
'
ERROR.ONLY_MEMBER_CAN_EXECUTE_THIS_ACTION
'
);
}
return
UIUtils
.
alert
.
confirm
(
'
WOT.CONFIRM.ASK_CERTIFICATION
'
,
undefined
,
{
okText
:
'
COMMON.BTN_SEND
'
})
...
...
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