Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OLAT CI-CD Testing Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor 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
Lars Oliver Dam
OLAT CI-CD Testing Project
Commits
c04b5f10
Commit
c04b5f10
authored
10 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
OO-1445: allow olat.(local.)properties settings for registration module
parent
d0816e58
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
src/main/java/org/olat/registration/RegistrationModule.java
+29
-16
29 additions, 16 deletions
src/main/java/org/olat/registration/RegistrationModule.java
src/test/java/org/olat/restapi/RegistrationTest.java
+3
-14
3 additions, 14 deletions
src/test/java/org/olat/restapi/RegistrationTest.java
with
32 additions
and
30 deletions
src/main/java/org/olat/registration/RegistrationModule.java
+
29
−
16
View file @
c04b5f10
...
...
@@ -99,6 +99,7 @@ public class RegistrationModule extends AbstractOLATModule {
}
public
void
setSelfRegistrationEnabled
(
boolean
enable
)
{
selfRegistrationEnabled
=
enable
;
String
value
=
enable
?
"true"
:
"false"
;
setStringProperty
(
"registration.enabled"
,
value
,
true
);
}
...
...
@@ -111,42 +112,45 @@ public class RegistrationModule extends AbstractOLATModule {
}
public
void
setStaticPropertyMappingEnabled
(
boolean
enable
)
{
staticPropertyMappingEnabled
=
enable
;
String
value
=
enable
?
"true"
:
"false"
;
setStringProperty
(
"static.prop.mapping.enabled"
,
value
,
true
);
}
public
String
getStaticPropertyMappingName
()
{
return
staticPropertyMappingName
;
return
staticPropertyMappingName
;
}
public
void
setStaticPropertyMappingName
(
String
value
)
{
valu
e
=
StringHelper
.
containsNonWhitespace
(
value
)
?
value
:
""
;
setStringProperty
(
"static.prop.mapping"
,
valu
e
,
true
);
staticPropertyMappingNam
e
=
StringHelper
.
containsNonWhitespace
(
value
)
?
value
:
""
;
setStringProperty
(
"static.prop.mapping"
,
staticPropertyMappingNam
e
,
true
);
}
public
String
getStaticPropertyMappingValue
()
{
return
staticPropertyMappingValue
;
return
staticPropertyMappingValue
;
}
public
void
setStaticPropertyMappingValue
(
String
value
)
{
v
alue
=
StringHelper
.
containsNonWhitespace
(
value
)
?
value
:
""
;
setStringProperty
(
"static.prop.mapping.value"
,
v
alue
,
true
);
staticPropertyMappingV
alue
=
StringHelper
.
containsNonWhitespace
(
value
)
?
value
:
""
;
setStringProperty
(
"static.prop.mapping.value"
,
staticPropertyMappingV
alue
,
true
);
}
public
boolean
isSelfRegistrationLinkEnabled
(){
return
selfRegistrationLinkEnabled
;
return
selfRegistrationLinkEnabled
;
}
public
void
setSelfRegistrationLinkEnabled
(
boolean
enable
)
{
selfRegistrationLinkEnabled
=
enable
;
String
value
=
enable
?
"true"
:
"false"
;
setStringProperty
(
"registration.link.enabled"
,
value
,
true
);
}
public
boolean
isSelfRegistrationLoginEnabled
(){
return
selfRegistrationLoginEnabled
;
return
selfRegistrationLoginEnabled
;
}
public
void
setSelfRegistrationLoginEnabled
(
boolean
enable
)
{
selfRegistrationLoginEnabled
=
enable
;
String
value
=
enable
?
"true"
:
"false"
;
setStringProperty
(
"registration.login.enabled"
,
value
,
true
);
}
...
...
@@ -156,7 +160,8 @@ public class RegistrationModule extends AbstractOLATModule {
}
public
void
setDomainListRaw
(
String
list
)
{
setStringProperty
(
"registration.domains"
,
normalizeDomainList
(
list
),
true
);
domainList
=
normalizeDomainList
(
list
);
setStringProperty
(
"registration.domains"
,
domainList
,
true
);
}
private
String
normalizeDomainList
(
String
list
)
{
...
...
@@ -210,35 +215,43 @@ public class RegistrationModule extends AbstractOLATModule {
public
void
init
()
{
//registration enabled/disabled
String
enabledObj
=
getStringPropertyValue
(
"registration.enabled"
,
true
);
selfRegistrationEnabled
=
"true"
.
equals
(
enabledObj
);
if
(
StringHelper
.
containsNonWhitespace
(
enabledObj
))
{
selfRegistrationEnabled
=
"true"
.
equals
(
enabledObj
);
}
//link registration enabled/disabled (rest)
String
linkEnabledObj
=
getStringPropertyValue
(
"registration.link.enabled"
,
true
);
selfRegistrationLinkEnabled
=
"true"
.
equals
(
linkEnabledObj
);
if
(
StringHelper
.
containsNonWhitespace
(
linkEnabledObj
))
{
selfRegistrationLinkEnabled
=
"true"
.
equals
(
linkEnabledObj
);
}
//link on the login page for registration enabled/disabled
String
loginEnabledObj
=
getStringPropertyValue
(
"registration.login.enabled"
,
true
);
selfRegistrationLoginEnabled
=
"true"
.
equals
(
loginEnabledObj
);
if
(
StringHelper
.
containsNonWhitespace
(
loginEnabledObj
))
{
selfRegistrationLoginEnabled
=
"true"
.
equals
(
loginEnabledObj
);
}
//white list of domains
String
domainObj
=
getStringPropertyValue
(
"registration.domains"
,
true
);
if
(
StringHelper
.
containsNonWhitespace
(
domainObj
))
{
domainList
=
domainObj
;
}
else
{
}
else
{
// allowed because to olat.properties for this
domainList
=
null
;
// reset
}
//static property mapping enabled/disabled
String
enabledPropObj
=
getStringPropertyValue
(
"static.prop.mapping.enabled"
,
true
);
staticPropertyMappingEnabled
=
"true"
.
equals
(
enabledPropObj
);
if
(
StringHelper
.
containsNonWhitespace
(
enabledPropObj
))
{
staticPropertyMappingEnabled
=
"true"
.
equals
(
enabledPropObj
);
}
String
propKeyObj
=
getStringPropertyValue
(
"static.prop.mapping"
,
tru
e
);
String
propKeyObj
=
getStringPropertyValue
(
"static.prop.mapping"
,
fals
e
);
if
(
StringHelper
.
containsNonWhitespace
(
propKeyObj
))
{
staticPropertyMappingName
=
propKeyObj
;
}
else
{
staticPropertyMappingName
=
null
;
// reset
}
String
propValueObj
=
getStringPropertyValue
(
"static.prop.mapping.value"
,
tru
e
);
String
propValueObj
=
getStringPropertyValue
(
"static.prop.mapping.value"
,
fals
e
);
if
(
StringHelper
.
containsNonWhitespace
(
propValueObj
))
{
staticPropertyMappingValue
=
propValueObj
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
src/test/java/org/olat/restapi/RegistrationTest.java
+
3
−
14
View file @
c04b5f10
...
...
@@ -32,11 +32,9 @@ import org.apache.http.Header;
import
org.apache.http.HttpResponse
;
import
org.apache.http.client.methods.HttpPut
;
import
org.apache.http.util.EntityUtils
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.olat.core.id.Identity
;
import
org.olat.core.id.UserConstants
;
import
org.olat.restapi.RestConnection
;
import
org.olat.test.JunitTestHelper
;
import
org.olat.test.OlatJerseyTestCase
;
...
...
@@ -51,17 +49,6 @@ import org.olat.test.OlatJerseyTestCase;
*/
public
class
RegistrationTest
extends
OlatJerseyTestCase
{
private
static
Identity
owner1
;
@Before
@Override
public
void
setUp
()
throws
Exception
{
super
.
setUp
();
//create a course with learn group
owner1
=
JunitTestHelper
.
createAndPersistIdentityAsUser
(
"rest-one"
);
}
@Test
public
void
testRegistration
()
throws
IOException
,
URISyntaxException
{
RestConnection
conn
=
new
RestConnection
();
...
...
@@ -79,10 +66,12 @@ public class RegistrationTest extends OlatJerseyTestCase {
@Test
public
void
testRedirectRegistration
()
throws
IOException
,
URISyntaxException
{
Identity
id
=
JunitTestHelper
.
createAndPersistIdentityAsUser
(
"rest-reg"
);
RestConnection
conn
=
new
RestConnection
();
URI
uri
=
conn
.
getContextURI
().
path
(
"registration"
)
.
queryParam
(
"email"
,
owner1
.
getUser
().
getProperty
(
UserConstants
.
EMAIL
,
null
)).
build
();
.
queryParam
(
"email"
,
id
.
getUser
().
getProperty
(
UserConstants
.
EMAIL
,
null
)).
build
();
HttpPut
put
=
conn
.
createPut
(
uri
,
"*/*"
,
"de"
,
true
);
HttpResponse
response
=
conn
.
execute
(
put
);
...
...
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