Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package org.apache.marmotta.platform.core.api.user;
 
Manages the user-resources (BASE_URL/users/*)

Author(s):
sschaffe
Jakob Frank <jakob.frank@salzburgresearch.at>
 
 public interface UserService {
 
     /* Current User Management */

    
Return the currently active user. The method tries to determine the current user using the following means:
  1. the user stored in the session, if existant
  2. the user authenticated using HTTP authentication, if existant
  3. the anonymous user
Child-Threads will inherit the current user from it's parent thread unless the current user was explicitly set.

Returns:
the resource for the current user.
See also:
setCurrentUser(org.openrdf.model.URI)
 
     public URI getCurrentUser();

    
Check whether the given resource is the anonyous user resource

Parameters:
user the resource to check
Returns:
true if the given resource equals the anonymous user resource.
See also:
getAnonymousUser()
 
     public boolean isAnonymous(URI user);

    
Set the current user to the user passed as argument. The current user should be associated with the current session in a thread local variable that is cleared again when the request finishes (KiWiUserTokenFilter)

Parameters:
user
 
     public void setCurrentUser(URI user);

    
Clear a current user setting for the current thread. Clears the thread local variable set for the currently running thread. This will revert the the current user to the state as it had never been set, i.e. inheriting from the parent thread.
 
     public void clearCurrentUser();
 
     /* User Token Management */

    
Create a new user with the provided login. The method first checks of a user with this login already exists; if yes, an exception is thrown.

Parameters:
login login of the user to create
Returns:
the newly created user.
 
     public URI createUser(String loginthrows UserExistsException;

    
Create a new user with the provided login, first name and last name. The method first checks of a user with this login already exists; if yes, an exception is thrown.

Parameters:
login login of the user to create
firstName first name of the user to create
lastName last name of the user to create
Returns:
the newly created user.
    public URI createUser(final String loginfinal String firstNamefinal String lastNamethrows UserExistsException;

    
Return the anonymous user. If it does not exist yet, it is created in the database and stored.

Returns:
the org.apache.marmotta.kiwi.model.rdf.KiWiUriResource representing the anonymous user.
    public URI getAnonymousUser();

    
Return the (default) admin user. If it does not exist yet, it is created in the database and stored.

Returns:
the org.apache.marmotta.kiwi.model.rdf.KiWiUriResource representing the user "admin".
    public URI getAdminUser();

    
Return a user by login. The user is looked up in the database and returned. In case no user with this login is found, this method returns null.

Parameters:
login the login to look for
Returns:
the user with the given login, or null if no such user exists
    public URI getUser(String login);

    
Check whether the user with the given login name already exists.

Parameters:
login the username to check
Returns:
true if it exists.
    public boolean userExists(String login);

    
Create the default users (namely "admin" and "anonymous").
    public void createDefaultUsers();
New to GrepCode? Check out our FAQ X