Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
arsnova-lite
Manage
Activity
Members
Labels
Plan
Issues
24
Issue boards
Milestones
Wiki
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Privacy
Imprint
Contact
Snippets
Groups
Projects
Show more breadcrumbs
ARSnova
arsnova-lite
Commits
959453c6
There was a problem fetching the pipeline stages.
Verified
Commit
959453c6
authored
7 years ago
by
Lukas Maximilian Kimpel
Browse files
Options
Downloads
Patches
Plain Diff
Implement flag whether a user is logged in as guest or not
parent
7914d1d4
1 merge request
!99
Resolve "Differentiate between guests and registered users"
Pipeline
#13771
passed with stage
in 33 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/models/user.ts
+3
-1
3 additions, 1 deletion
src/app/models/user.ts
src/app/services/http/authentication.service.ts
+6
-4
6 additions, 4 deletions
src/app/services/http/authentication.service.ts
with
9 additions
and
5 deletions
src/app/models/user.ts
+
3
−
1
View file @
959453c6
...
@@ -7,12 +7,14 @@ export class User {
...
@@ -7,12 +7,14 @@ export class User {
authProvider
:
AuthProvider
;
authProvider
:
AuthProvider
;
token
:
string
;
token
:
string
;
role
:
UserRole
;
role
:
UserRole
;
isGuest
:
boolean
;
constructor
(
id
:
string
,
loginId
:
string
,
authProvider
:
AuthProvider
,
token
:
string
,
role
:
UserRole
)
{
constructor
(
id
:
string
,
loginId
:
string
,
authProvider
:
AuthProvider
,
token
:
string
,
role
:
UserRole
,
isGuest
:
boolean
)
{
this
.
id
=
id
;
this
.
id
=
id
;
this
.
loginId
=
loginId
;
this
.
loginId
=
loginId
;
this
.
authProvider
=
authProvider
;
this
.
authProvider
=
authProvider
;
this
.
token
=
token
;
this
.
token
=
token
;
this
.
role
=
role
;
this
.
role
=
role
;
this
.
isGuest
=
isGuest
;
}
}
}
}
This diff is collapsed.
Click to expand it.
src/app/services/http/authentication.service.ts
+
6
−
4
View file @
959453c6
...
@@ -40,13 +40,13 @@ export class AuthenticationService {
...
@@ -40,13 +40,13 @@ export class AuthenticationService {
return
this
.
checkLogin
(
this
.
http
.
post
<
ClientAuthentication
>
(
connectionUrl
,
{
return
this
.
checkLogin
(
this
.
http
.
post
<
ClientAuthentication
>
(
connectionUrl
,
{
loginId
:
email
,
loginId
:
email
,
password
:
password
password
:
password
},
this
.
httpOptions
),
userRole
);
},
this
.
httpOptions
),
userRole
,
false
);
}
}
guestLogin
():
Observable
<
boolean
>
{
guestLogin
():
Observable
<
boolean
>
{
const
connectionUrl
:
string
=
this
.
apiUrl
.
base
+
this
.
apiUrl
.
auth
+
this
.
apiUrl
.
login
+
this
.
apiUrl
.
guest
;
const
connectionUrl
:
string
=
this
.
apiUrl
.
base
+
this
.
apiUrl
.
auth
+
this
.
apiUrl
.
login
+
this
.
apiUrl
.
guest
;
return
this
.
checkLogin
(
this
.
http
.
post
<
ClientAuthentication
>
(
connectionUrl
,
null
,
this
.
httpOptions
),
UserRole
.
PARTICIPANT
);
return
this
.
checkLogin
(
this
.
http
.
post
<
ClientAuthentication
>
(
connectionUrl
,
null
,
this
.
httpOptions
),
UserRole
.
PARTICIPANT
,
true
);
}
}
register
(
email
:
string
,
password
:
string
):
Observable
<
boolean
>
{
register
(
email
:
string
,
password
:
string
):
Observable
<
boolean
>
{
...
@@ -98,14 +98,16 @@ export class AuthenticationService {
...
@@ -98,14 +98,16 @@ export class AuthenticationService {
return
this
.
user
.
token
;
return
this
.
user
.
token
;
}
}
private
checkLogin
(
clientAuthentication
:
Observable
<
ClientAuthentication
>
,
userRole
:
UserRole
):
Observable
<
boolean
>
{
private
checkLogin
(
clientAuthentication
:
Observable
<
ClientAuthentication
>
,
userRole
:
UserRole
,
isGuest
:
boolean
):
Observable
<
boolean
>
{
return
clientAuthentication
.
map
(
result
=>
{
return
clientAuthentication
.
map
(
result
=>
{
if
(
result
)
{
if
(
result
)
{
this
.
setUser
(
new
User
(
this
.
setUser
(
new
User
(
result
.
userId
,
result
.
userId
,
result
.
loginId
,
result
.
loginId
,
result
.
authProvider
,
result
.
authProvider
,
result
.
token
,
userRole
));
result
.
token
,
userRole
,
isGuest
));
return
true
;
return
true
;
}
else
{
}
else
{
return
false
;
return
false
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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