Class MetadataService
java.lang.Object
com.linecorp.centraldogma.server.metadata.MetadataService
A service class for metadata management.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionMetadataService
(ProjectManager projectManager, CommandExecutor executor) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionactivateToken
(Author author, String appId) Activates theToken
of the specifiedappId
.addMember
(Author author, String projectName, User member, ProjectRole projectRole) Adds the specifiedmember
to theProjectMetadata
of the specifiedprojectName
with the specifiedprojectRole
.addPerTokenPermission
(Author author, String projectName, String repoName, String appId, Collection<Permission> permission) AddsPermission
s for theToken
of the specifiedappId
to the specifiedrepoName
in the specifiedprojectName
.addPerUserPermission
(Author author, String projectName, String repoName, User member, Collection<Permission> permission) Adds aRepositoryMetadata
of the specifiedrepoName
to the specifiedprojectName
with a defaultPerRolePermissions
.addRepo
(Author author, String projectName, String repoName, PerRolePermissions permission) Adds aRepositoryMetadata
of the specifiedrepoName
to the specifiedprojectName
with the specifiedPerRolePermissions
.addToken
(Author author, String projectName, Token token, ProjectRole role) Adds the specifiedToken
to the specifiedprojectName
.addToken
(Author author, String projectName, String appId, ProjectRole role) createToken
(Author author, String appId) Creates a new user-levelToken
with the specifiedappId
.createToken
(Author author, String appId, boolean isAdmin) createToken
(Author author, String appId, String secret) createToken
(Author author, String appId, String secret, boolean isAdmin) deactivateToken
(Author author, String appId) Deactivates theToken
of the specifiedappId
.destroyToken
(Author author, String appId) Removes theToken
of the specifiedappId
completely from the system.findPermissions
(String projectName, String repoName, User user) FindsPermission
s which belong to the specifiedUser
orUserWithToken
from the specifiedrepoName
in the specifiedprojectName
.findPermissions
(String projectName, String repoName, String appId) FindsPermission
s which belong to the specifiedappId
from the specifiedrepoName
in the specifiedprojectName
.findTokenByAppId
(String appId) Returns aToken
which has the specifiedappId
.findTokenBySecret
(String secret) Returns aToken
which has the specifiedsecret
.getProject
(String projectName) Returns aProjectMetadata
whose name equals to the specifiedprojectName
.Returns aTokens
.purgeToken
(Author author, String appId) Purges theToken
of the specifiedappId
that was removed before.removeMember
(Author author, String projectName, User member) removePerTokenPermission
(Author author, String projectName, String repoName, String appId) RemovesPermission
s for theToken
of the specifiedappId
from the specifiedrepoName
in the specifiedprojectName
.removePerUserPermission
(Author author, String projectName, String repoName, User member) RemovesPermission
s for the specifiedmember
from the specifiedrepoName
in the specifiedprojectName
.removeProject
(Author author, String projectName) Removes aProjectMetadata
whose name equals to the specifiedprojectName
.removeRepo
(Author author, String projectName, String repoName) removeToken
(Author author, String projectName, Token token) Removes the specifiedToken
from the specifiedprojectName
.removeToken
(Author author, String projectName, String appId) restoreProject
(Author author, String projectName) Restores aProjectMetadata
whose name equals to the specifiedprojectName
.restoreRepo
(Author author, String projectName, String repoName) updateMemberRole
(Author author, String projectName, User member, ProjectRole projectRole) updatePerRolePermissions
(Author author, String projectName, String repoName, PerRolePermissions perRolePermissions) updatePerTokenPermission
(Author author, String projectName, String repoName, String appId, Collection<Permission> permission) UpdatesPermission
s for theToken
of the specifiedappId
of the specifiedrepoName
in the specifiedprojectName
.updatePerUserPermission
(Author author, String projectName, String repoName, User member, Collection<Permission> permission) UpdatesPermission
s for the specifiedmember
of the specifiedrepoName
in the specifiedprojectName
.updateTokenRole
(Author author, String projectName, Token token, ProjectRole role) updateWriteQuota
(Author author, String projectName, String repoName, QuotaConfig writeQuota)
-
Field Details
-
METADATA_JSON
A path of metadata file.- See Also:
-
TOKEN_JSON
A path of token list file.- See Also:
-
-
Constructor Details
-
MetadataService
Creates a new instance.
-
-
Method Details
-
getProject
Returns aProjectMetadata
whose name equals to the specifiedprojectName
. -
removeProject
Removes aProjectMetadata
whose name equals to the specifiedprojectName
. -
restoreProject
Restores aProjectMetadata
whose name equals to the specifiedprojectName
. -
getMember
-
addMember
public CompletableFuture<Revision> addMember(Author author, String projectName, User member, ProjectRole projectRole) Adds the specifiedmember
to theProjectMetadata
of the specifiedprojectName
with the specifiedprojectRole
. -
removeMember
Removes the specifiedmember
from theProjectMetadata
in the specifiedprojectName
. It also removes permission of the specifiedmember
from everyRepositoryMetadata
. -
updateMemberRole
public CompletableFuture<Revision> updateMemberRole(Author author, String projectName, User member, ProjectRole projectRole) -
getRepo
-
addRepo
Adds aRepositoryMetadata
of the specifiedrepoName
to the specifiedprojectName
with a defaultPerRolePermissions
. -
addRepo
public CompletableFuture<Revision> addRepo(Author author, String projectName, String repoName, PerRolePermissions permission) Adds aRepositoryMetadata
of the specifiedrepoName
to the specifiedprojectName
with the specifiedPerRolePermissions
. -
removeRepo
-
purgeRepo
-
restoreRepo
-
updatePerRolePermissions
public CompletableFuture<Revision> updatePerRolePermissions(Author author, String projectName, String repoName, PerRolePermissions perRolePermissions) -
addToken
public CompletableFuture<Revision> addToken(Author author, String projectName, Token token, ProjectRole role) Adds the specifiedToken
to the specifiedprojectName
. -
addToken
public CompletableFuture<Revision> addToken(Author author, String projectName, String appId, ProjectRole role) -
removeToken
Removes the specifiedToken
from the specifiedprojectName
. It also removes every token permission belonging to theToken
from everyRepositoryMetadata
. -
removeToken
Removes theToken
of the specifiedappId
from the specifiedprojectName
. It also removes every token permission belonging toToken
from everyRepositoryMetadata
. -
updateTokenRole
public CompletableFuture<Revision> updateTokenRole(Author author, String projectName, Token token, ProjectRole role) -
addPerUserPermission
public CompletableFuture<Revision> addPerUserPermission(Author author, String projectName, String repoName, User member, Collection<Permission> permission) -
removePerUserPermission
public CompletableFuture<Revision> removePerUserPermission(Author author, String projectName, String repoName, User member) RemovesPermission
s for the specifiedmember
from the specifiedrepoName
in the specifiedprojectName
. -
updatePerUserPermission
public CompletableFuture<Revision> updatePerUserPermission(Author author, String projectName, String repoName, User member, Collection<Permission> permission) UpdatesPermission
s for the specifiedmember
of the specifiedrepoName
in the specifiedprojectName
. -
addPerTokenPermission
public CompletableFuture<Revision> addPerTokenPermission(Author author, String projectName, String repoName, String appId, Collection<Permission> permission) AddsPermission
s for theToken
of the specifiedappId
to the specifiedrepoName
in the specifiedprojectName
. -
removePerTokenPermission
public CompletableFuture<Revision> removePerTokenPermission(Author author, String projectName, String repoName, String appId) RemovesPermission
s for theToken
of the specifiedappId
from the specifiedrepoName
in the specifiedprojectName
. -
updatePerTokenPermission
public CompletableFuture<Revision> updatePerTokenPermission(Author author, String projectName, String repoName, String appId, Collection<Permission> permission) UpdatesPermission
s for theToken
of the specifiedappId
of the specifiedrepoName
in the specifiedprojectName
. -
updateWriteQuota
public CompletableFuture<Revision> updateWriteQuota(Author author, String projectName, String repoName, QuotaConfig writeQuota) -
findPermissions
public CompletableFuture<Collection<Permission>> findPermissions(String projectName, String repoName, User user) FindsPermission
s which belong to the specifiedUser
orUserWithToken
from the specifiedrepoName
in the specifiedprojectName
. -
findPermissions
public CompletableFuture<Collection<Permission>> findPermissions(String projectName, String repoName, String appId) FindsPermission
s which belong to the specifiedappId
from the specifiedrepoName
in the specifiedprojectName
. -
findRole
-
getTokens
Returns aTokens
. -
createToken
Creates a new user-levelToken
with the specifiedappId
. A secret for theappId
will be automatically generated. -
createToken
-
createToken
-
createToken
public CompletableFuture<Revision> createToken(Author author, String appId, String secret, boolean isAdmin) -
destroyToken
Removes theToken
of the specifiedappId
completely from the system. -
purgeToken
Purges theToken
of the specifiedappId
that was removed before.Note that this is a blocking method that should not be invoked in an event loop.
-
activateToken
Activates theToken
of the specifiedappId
. -
deactivateToken
Deactivates theToken
of the specifiedappId
. -
findTokenByAppId
Returns aToken
which has the specifiedappId
. -
findTokenBySecret
Returns aToken
which has the specifiedsecret
.
-