|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.bc.issue.attachment.DefaultAttachmentService
public class DefaultAttachmentService
Constructor Summary | |
---|---|
DefaultAttachmentService(AttachmentManager attachmentManager,
PermissionManager permissionManager,
JiraAuthenticationContext jiraAuthenticationContext,
IssueUpdater issueUpdater,
IssueManager issueManager)
|
Method Summary | |
---|---|
boolean |
canAttachScreenshots(JiraServiceContext jiraServiceContext,
Issue issue)
Determines whether the user: has the required permission ( Permissions.CREATE_ATTACHMENT )
to create an attachment
has the screenshot enabled
is using a screenshot applet compatible OS (Windows or OSX)
the issue is in an editable workflow state
|
boolean |
canCreateAttachments(JiraServiceContext jiraServiceContext,
Issue issue)
Determines whether attachments are enabled in JIRA and that the user has the required permission ( Permissions.CREATE_ATTACHMENT ) to create an attachment for this issue. |
(package private) boolean |
canDeleteAnyAttachment(User user,
Issue issue,
ErrorCollection errorCollection)
Retrieves the attachments associated with the specified issue and determines whether the user has permission to delete one or more of them (granted by the Permissions.ATTACHMENT_DELETE_ALL
or Permissions.ATTACHMENT_DELETE_OWN permission). |
boolean |
canDeleteAttachment(JiraServiceContext jiraServiceContext,
Long attachmentId)
Retrieves the attachment specified by the attachment id and determines if the user can delete it. |
boolean |
canManageAttachments(JiraServiceContext jiraServiceContext,
Issue issue)
Checks whether the user has permission to manage the attachments of the specified issue. |
(package private) IssueUpdateBean |
constructIssueUpdateBeanForAttachmentDelete(Attachment attachment,
Issue issue,
User user)
|
void |
delete(JiraServiceContext jiraServiceContext,
Long attachmentId)
Deletes the specified attachment and updates the issue change history and 'updated' date. |
(package private) Attachment |
getAndVerifyAttachment(Long attachmentId,
ErrorCollection errorCollection)
|
(package private) Issue |
getAndVerifyIssue(Attachment attachment,
ErrorCollection errorCollection)
|
Attachment |
getAttachment(JiraServiceContext jiraServiceContext,
Long attachmentId)
Retrieves the specified issue. |
(package private) boolean |
isAttachmentsEnabledAndPathSet()
|
(package private) boolean |
isAuthorOfAtLeastOneAttachment(Issue issue,
User user)
|
(package private) boolean |
isIssueInEditableWorkflowState(Issue issue)
|
(package private) boolean |
isScreenshotAppletEnabledAndSupportedByOS(JiraServiceContext jiraServiceContext)
|
(package private) boolean |
isUserAttachmentAuthor(Attachment attachment,
User user)
|
(package private) boolean |
userHasAttachmentDeleteAllPermission(Issue issue,
User user)
|
(package private) boolean |
userHasAttachmentDeleteOwnPermission(Issue issue,
User user)
|
(package private) boolean |
userHasCreateAttachmentPermission(Issue issue,
User user)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultAttachmentService(AttachmentManager attachmentManager, PermissionManager permissionManager, JiraAuthenticationContext jiraAuthenticationContext, IssueUpdater issueUpdater, IssueManager issueManager)
Method Detail |
---|
public boolean canDeleteAttachment(JiraServiceContext jiraServiceContext, Long attachmentId)
AttachmentService
canDeleteAttachment
in interface AttachmentService
jiraServiceContext
- containing the user who the permission checks will be run against (can be null,
indicating an anonymous user) and the errorCollection that will contain any errors in calling the methodattachmentId
- specifies the attachment to be deleted
public boolean canManageAttachments(JiraServiceContext jiraServiceContext, Issue issue)
AttachmentService
canManageAttachments
in interface AttachmentService
jiraServiceContext
- containing the user who the permission checks will be run against (can be null,
indicating an anonymous user) and the errorCollection that will contain any errors in calling the methodissue
- who's attachments will be checked against the specified user's delete permissions (if the issue
is null an error will be placed into the supplied ErrorCollection and false will be returned)
public void delete(JiraServiceContext jiraServiceContext, Long attachmentId)
AttachmentService
AttachmentService.canDeleteAttachment(com.atlassian.jira.bc.JiraServiceContext, Long)
has been successfully called.
delete
in interface AttachmentService
jiraServiceContext
- containing the user who is attempting to delete the attachment and the errorCollection
that will contain any errors in calling the methodattachmentId
- of the target attachment, must not be null and must identify a valid attachmentpublic Attachment getAttachment(JiraServiceContext jiraServiceContext, Long attachmentId)
AttachmentService
getAttachment
in interface AttachmentService
jiraServiceContext
- containing the user who is attempting to retrieve the attachment and the errorCollection
that will contain any errors in calling the methodattachmentId
- of the target attachment, must not be null and must identify a valid attachment
public boolean canCreateAttachments(JiraServiceContext jiraServiceContext, Issue issue)
AttachmentService
Permissions.CREATE_ATTACHMENT
) to create an attachment for this issue.
This method also checks that the provided issue is in an editable workflow state.
canCreateAttachments
in interface AttachmentService
jiraServiceContext
- containing the user who wishes to create an attachment and the errorCollection
that will contain any errors in calling the methodissue
- that will have an attachment attached to it
public boolean canAttachScreenshots(JiraServiceContext jiraServiceContext, Issue issue)
AttachmentService
Permissions.CREATE_ATTACHMENT
)
to create an attachment
canAttachScreenshots
in interface AttachmentService
jiraServiceContext
- containing the user who wishes to attach a screenshot and the errorCollection
that will contain any errors in calling the methodissue
- that will have the screenshot attached to it
boolean isIssueInEditableWorkflowState(Issue issue)
boolean isScreenshotAppletEnabledAndSupportedByOS(JiraServiceContext jiraServiceContext)
boolean isAttachmentsEnabledAndPathSet()
Issue getAndVerifyIssue(Attachment attachment, ErrorCollection errorCollection)
Attachment getAndVerifyAttachment(Long attachmentId, ErrorCollection errorCollection)
IssueUpdateBean constructIssueUpdateBeanForAttachmentDelete(Attachment attachment, Issue issue, User user)
boolean userHasAttachmentDeleteAllPermission(Issue issue, User user)
boolean userHasAttachmentDeleteOwnPermission(Issue issue, User user)
boolean userHasCreateAttachmentPermission(Issue issue, User user)
boolean isUserAttachmentAuthor(Attachment attachment, User user)
boolean isAuthorOfAtLeastOneAttachment(Issue issue, User user)
boolean canDeleteAnyAttachment(User user, Issue issue, ErrorCollection errorCollection)
Permissions.ATTACHMENT_DELETE_ALL
or Permissions.ATTACHMENT_DELETE_OWN
permission).
If the user has the
Permissions.ATTACHMENT_DELETE_ALL
permission the attachments will not be
checked.
user
- who the permission checks will be run against (can be null, indicating an anonymous user)issue
- who's attachments will be checked against the specified user's delete permissions (if the issue
is null an error will be placed into the supplied ErrorCollection and false will be returned)errorCollection
- will contain any errors in calling the method
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |