protected override async Task <PermissionResult> CanDeleteAsync(Token value)
        {
            if (!String.IsNullOrEmpty(value.ProjectId) && !await IsInProjectAsync(value.ProjectId))
            {
                return(PermissionResult.DenyWithNotFound(value.Id));
            }

            return(await base.CanDeleteAsync(value));
        }
Esempio n. 2
0
        protected override PermissionResult CanDelete(WebHook value)
        {
            if (!IsInProject(value.ProjectId))
            {
                return(PermissionResult.DenyWithNotFound(value.Id));
            }

            return(base.CanDelete(value));
        }
Esempio n. 3
0
        protected override PermissionResult CanDelete(Token value)
        {
            if (!String.IsNullOrEmpty(value.ProjectId) && !IsInProject(value.ProjectId))
            {
                return(PermissionResult.DenyWithNotFound(value.Id));
            }

            return(base.CanDelete(value));
        }
    protected virtual async Task <PermissionResult> CanDeleteAsync(TModel value)
    {
        if (value is IOwnedByOrganization orgModel && !CanAccessOrganization(orgModel.OrganizationId))
        {
            return(PermissionResult.DenyWithNotFound(value.Id));
        }

        return(PermissionResult.Allow);
    }
        protected override async Task <PermissionResult> CanDeleteAsync(Token value)
        {
            if (!User.IsInRole(AuthorizationRoles.GlobalAdmin) && !String.IsNullOrEmpty(value.UserId) && value.UserId != CurrentUser.Id)
            {
                return(PermissionResult.DenyWithMessage("Can only delete tokens created by you."));
            }

            if (!String.IsNullOrEmpty(value.ProjectId) && !await IsInProjectAsync(value.ProjectId))
            {
                return(PermissionResult.DenyWithNotFound(value.Id));
            }

            return(await base.CanDeleteAsync(value));
        }
        protected override async Task <PermissionResult> CanDeleteAsync(WebHook value)
        {
            if (!String.IsNullOrEmpty(value.ProjectId) && !await IsInProjectAsync(value.ProjectId))
            {
                return(PermissionResult.DenyWithNotFound(value.Id));
            }

            if (!String.IsNullOrEmpty(value.OrganizationId) && !IsInOrganization(value.OrganizationId))
            {
                return(PermissionResult.DenyWithNotFound(value.Id));
            }

            return(PermissionResult.Allow);
        }