public final class UserGroupMethods extends Object
Constructor and Description |
---|
UserGroupMethods(io.toro.martini.permissions.AccessControlService accessControlService) |
Modifier and Type | Method and Description |
---|---|
static void |
addUserToGroup(String username,
String groupname)
Add a user to a group by name.
|
static void |
deleteGroupByName(String groupName)
Delete a group by name.
|
static void |
deleteUser(String id)
Delete a user by ID.
|
static void |
deleteUserByUsername(String username)
Delete a user by username.
|
static GloopModel |
findAccessTokenByUserId(String userId)
Retrieves the access token of the user, whose id matches
the provided string.
|
static GloopModel |
findAccessTokenByUsername(String userName)
Retrieves the access token of the user, whose username matches
the provided string.
|
static List<String> |
findGroups()
Get the names of all registered groups.
|
static GloopModel |
findUser(String username)
Retrieve the user matching the provided username.
|
static GloopModel |
findUser(String username,
String password)
Retrieve the user, whose credentials match the provided username and password.
|
static GloopModel |
findUserByEmail(String emailAddress)
Retrieve a user by email address.
|
static GloopModel |
findUserById(String userId)
Retrieve a user by ID.
|
static GloopModel |
findUsers(groovy.lang.Closure predicateClosure)
Filters existing users, returning only users matching the provided predicate.
|
static GloopModel |
generateToken(String userName)
Generates an access token for the user, whose username matches
the provided string.
|
static boolean |
groupExists(String name)
Checks whether or not a group with the provided name exists.
|
static List<String> |
groupsExist(List<String> groupNames)
Filters the provided list of group names, returning only the names of groups that exist.
|
static void |
removeUserFromGroup(String username,
String groupname)
Remove a user from a group by name.
|
static void |
saveGroup(String groupName)
Save a new group.
|
static void |
saveUser(GloopModel user) |
@Autowired UserGroupMethods(io.toro.martini.permissions.AccessControlService accessControlService)
@GloopObjectParameter(value="user{\n user#io.toro.martini.user.User{\n }\n}") public static GloopModel findUser(@GloopParameter(allowNull=false) String username)
@GloopObjectParameter(value="user{\n user#io.toro.martini.user.User{\n }\n}") public static GloopModel findUser(@GloopParameter(allowNull=false) String username, @GloopParameter(allowNull=false) String password)
@GloopObjectParameter(value="user{\n user#io.toro.martini.user.User{\n }\n}") public static GloopModel findUserById(@GloopParameter(allowNull=false) String userId)
userId
- the ID of the user to get@GloopObjectParameter(value="user{\n user#io.toro.martini.user.User{\n }\n}") public static GloopModel findUserByEmail(@GloopParameter(allowNull=false) String emailAddress)
emailAddress
- the email address of the user to getpublic static boolean groupExists(@GloopParameter(allowNull=false) String name)
name
- the name of the group to look forpublic static List<String> groupsExist(@GloopParameter(allowNull=false) List<String> groupNames)
groupNames
- the list of group names to filterpublic static void saveUser(@GloopParameter(allowNull=false) @GloopObjectParameter(value="user#io.toro.martini.user.User{\n}") GloopModel user)
user
- the user to persist@GloopObjectParameter(value="users{\n users#io.toro.martini.user.User[]{\n }\n}") public static GloopModel findUsers(groovy.lang.Closure predicateClosure)
predicateClosure
- a Groovy closure that
receives one argument, called it
that is a User
object;
and returns a boolean value indicating whether or not to include a user in the result or notpublic static List<String> findGroups()
public static void saveGroup(@GloopParameter(allowNull=false) String groupName)
groupName
- the name of the group to persistpublic static void addUserToGroup(@GloopParameter(allowNull=false) String username, @GloopParameter(allowNull=false) String groupname)
username
- the name of the user to add to the groupgroupname
- the name of the group where to add the user topublic static void removeUserFromGroup(@GloopParameter(allowNull=false) String username, @GloopParameter(allowNull=false) String groupname)
username
- the name of the user to remove from the groupgroupname
- the name of the group where to remove the user frompublic static void deleteUser(@GloopParameter(allowNull=false) String id)
id
- the ID of the user to deletepublic static void deleteUserByUsername(@GloopParameter(allowNull=false) String username)
username
- the username of the user to deletepublic static void deleteGroupByName(@GloopParameter(allowNull=false) String groupName)
groupName
- the name of the group to delete@GloopObjectParameter(value="token{\n token#io.toro.martini.user.AccessToken{\n }\n}") public static GloopModel findAccessTokenByUserId(String userId)
userId
- the ID of the user@GloopObjectParameter(value="token{\n token#io.toro.martini.user.AccessToken{\n }\n}") public static GloopModel findAccessTokenByUsername(String userName)
userName
- the username of the user@GloopObjectParameter(value="token{\n token#io.toro.martini.user.AccessToken{\n }\n}") public static GloopModel generateToken(String userName)
userName
- the username of the userCopyright © 2021. All rights reserved.