Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ARSnova Backend
Manage
Activity
Members
Labels
Plan
Issues
27
Issue boards
Milestones
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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 Backend
Commits
31a2613b
Commit
31a2613b
authored
12 years ago
by
Julian Hochstetter
Browse files
Options
Downloads
Patches
Plain Diff
Task #4061: die Rolle des Benutzers muss berücksichtigt werden
parent
53942f1a
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/de/thm/arsnova/dao/CouchDBDao.java
+17
-3
17 additions, 3 deletions
src/main/java/de/thm/arsnova/dao/CouchDBDao.java
src/main/java/de/thm/arsnova/entities/User.java
+16
-7
16 additions, 7 deletions
src/main/java/de/thm/arsnova/entities/User.java
with
33 additions
and
10 deletions
src/main/java/de/thm/arsnova/dao/CouchDBDao.java
+
17
−
3
View file @
31a2613b
...
@@ -204,10 +204,24 @@ public class CouchDBDao implements IDatabaseDao {
...
@@ -204,10 +204,24 @@ public class CouchDBDao implements IDatabaseDao {
if
(
session
==
null
)
{
if
(
session
==
null
)
{
throw
new
NotFoundException
();
throw
new
NotFoundException
();
}
}
User
user
=
this
.
userService
.
getCurrentUser
();
View
view
=
null
;
try
{
try
{
View
view
=
new
View
(
"skill_question/by_session_sorted_by_subject_and_text"
);
if
(
session
.
getCreator
().
equals
(
user
.
getUsername
()))
{
view
.
setStartKey
(
"["
+
URLEncoder
.
encode
(
"\""
+
session
.
get_id
()
+
"\""
,
"UTF-8"
)
+
"]"
);
view
=
new
View
(
"skill_question/by_session_sorted_by_subject_and_text"
);
view
.
setEndKey
(
"["
+
URLEncoder
.
encode
(
"\""
+
session
.
get_id
()
+
"\",{}"
,
"UTF-8"
)
+
"]"
);
view
.
setStartKey
(
"["
+
URLEncoder
.
encode
(
"\""
+
session
.
get_id
()
+
"\""
,
"UTF-8"
)
+
"]"
);
view
.
setEndKey
(
"["
+
URLEncoder
.
encode
(
"\""
+
session
.
get_id
()
+
"\",{}"
,
"UTF-8"
)
+
"]"
);
}
else
{
if
(
user
.
getType
().
equals
(
User
.
THM
))
{
view
=
new
View
(
"skill_question/by_session_for_thm"
);
}
else
{
view
=
new
View
(
"skill_question/by_session_for_all"
);
}
view
.
setKey
(
URLEncoder
.
encode
(
"\""
+
session
.
get_id
()
+
"\""
,
"UTF-8"
));
}
ViewResults
questions
=
this
.
getDatabase
().
view
(
view
);
ViewResults
questions
=
this
.
getDatabase
().
view
(
view
);
if
(
questions
==
null
||
questions
.
isEmpty
())
{
if
(
questions
==
null
||
questions
.
isEmpty
())
{
...
...
This diff is collapsed.
Click to expand it.
src/main/java/de/thm/arsnova/entities/User.java
+
16
−
7
View file @
31a2613b
...
@@ -10,38 +10,47 @@ import org.springframework.security.authentication.AnonymousAuthenticationToken;
...
@@ -10,38 +10,47 @@ import org.springframework.security.authentication.AnonymousAuthenticationToken;
import
org.springframework.security.authentication.UsernamePasswordAuthenticationToken
;
import
org.springframework.security.authentication.UsernamePasswordAuthenticationToken
;
public
class
User
implements
Serializable
{
public
class
User
implements
Serializable
{
public
static
final
String
GOOGLE
=
"google"
;
public
static
final
String
TWITTER
=
"twitter"
;
public
static
final
String
FACEBOOK
=
"facebook"
;
public
static
final
String
THM
=
"thm"
;
public
static
final
String
LDAP
=
"ldap"
;
public
static
final
String
ANONYMOUS
=
"anonymous"
;
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
private
String
username
;
private
String
username
;
private
String
type
;
private
String
type
;
public
User
(
Google2Profile
profile
)
{
public
User
(
Google2Profile
profile
)
{
setUsername
(
profile
.
getEmail
());
setUsername
(
profile
.
getEmail
());
setType
(
"google"
);
setType
(
User
.
GOOGLE
);
}
}
public
User
(
TwitterProfile
profile
)
{
public
User
(
TwitterProfile
profile
)
{
setUsername
(
profile
.
getScreenName
());
setUsername
(
profile
.
getScreenName
());
setType
(
"twitter"
);
setType
(
User
.
TWITTER
);
}
}
public
User
(
FacebookProfile
profile
)
{
public
User
(
FacebookProfile
profile
)
{
setUsername
(
profile
.
getLink
());
setUsername
(
profile
.
getLink
());
setType
(
"facebook"
);
setType
(
User
.
FACEBOOK
);
}
}
public
User
(
AttributePrincipal
principal
)
{
public
User
(
AttributePrincipal
principal
)
{
setUsername
(
principal
.
getName
());
setUsername
(
principal
.
getName
());
setType
(
"thm"
);
setType
(
User
.
THM
);
}
}
public
User
(
AnonymousAuthenticationToken
token
)
{
public
User
(
AnonymousAuthenticationToken
token
)
{
setUsername
(
"anonymous"
);
setUsername
(
User
.
ANONYMOUS
);
setType
(
"anonymous"
);
setType
(
User
.
ANONYMOUS
);
}
}
public
User
(
UsernamePasswordAuthenticationToken
token
)
{
public
User
(
UsernamePasswordAuthenticationToken
token
)
{
setUsername
(
token
.
getName
());
setUsername
(
token
.
getName
());
setType
(
"ldap"
);
setType
(
LDAP
);
}
}
public
String
getUsername
()
{
public
String
getUsername
()
{
...
...
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