mirror of
https://github.com/mediacms-io/mediacms.git
synced 2026-05-05 20:23:26 -04:00
a
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 5.2.6 on 2026-04-21 15:54
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('files', '0016_category_lti_platform'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='mediapermission',
|
||||||
|
name='source',
|
||||||
|
field=models.CharField(choices=[('lti_embed', 'LTI Embed'), ('explicit', 'Explicit')], default='explicit', max_length=32),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -981,10 +981,18 @@ class MediaPermission(models.Model):
|
|||||||
("owner", "Owner"),
|
("owner", "Owner"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
SOURCE_LTI_EMBED = 'lti_embed'
|
||||||
|
SOURCE_EXPLICIT = 'explicit'
|
||||||
|
SOURCE_CHOICES = (
|
||||||
|
(SOURCE_LTI_EMBED, 'LTI Embed'),
|
||||||
|
(SOURCE_EXPLICIT, 'Explicit'),
|
||||||
|
)
|
||||||
|
|
||||||
owner_user = models.ForeignKey('users.User', on_delete=models.CASCADE, related_name='granted_permissions')
|
owner_user = models.ForeignKey('users.User', on_delete=models.CASCADE, related_name='granted_permissions')
|
||||||
user = models.ForeignKey('users.User', on_delete=models.CASCADE)
|
user = models.ForeignKey('users.User', on_delete=models.CASCADE)
|
||||||
media = models.ForeignKey('Media', on_delete=models.CASCADE, related_name='permissions')
|
media = models.ForeignKey('Media', on_delete=models.CASCADE, related_name='permissions')
|
||||||
permission = models.CharField(max_length=20, choices=PERMISSION_CHOICES)
|
permission = models.CharField(max_length=20, choices=PERMISSION_CHOICES)
|
||||||
|
source = models.CharField(max_length=32, choices=SOURCE_CHOICES, default=SOURCE_EXPLICIT)
|
||||||
created_at = models.DateTimeField(auto_now_add=True)
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|||||||
@@ -183,7 +183,10 @@ class MediaList(APIView):
|
|||||||
else:
|
else:
|
||||||
base_queryset = Media.objects.prefetch_related("user", "tags")
|
base_queryset = Media.objects.prefetch_related("user", "tags")
|
||||||
|
|
||||||
# Build OR conditions similar to _get_media_queryset
|
exclude_lti_embed = request.GET.get('exclude_lti_embed') == '1'
|
||||||
|
if exclude_lti_embed:
|
||||||
|
conditions = Q(permissions__user=request.user, permissions__source=MediaPermission.SOURCE_EXPLICIT)
|
||||||
|
else:
|
||||||
conditions = Q(permissions__user=request.user)
|
conditions = Q(permissions__user=request.user)
|
||||||
|
|
||||||
if getattr(settings, 'USE_RBAC', False):
|
if getattr(settings, 'USE_RBAC', False):
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { LinksContext, MemberContext, SiteContext } from '../../utils/contexts/'
|
|||||||
import { PageStore, ProfilePageStore } from '../../utils/stores/';
|
import { PageStore, ProfilePageStore } from '../../utils/stores/';
|
||||||
import { PageActions, ProfilePageActions } from '../../utils/actions/';
|
import { PageActions, ProfilePageActions } from '../../utils/actions/';
|
||||||
import { CircleIconButton, PopupMain } from '../_shared';
|
import { CircleIconButton, PopupMain } from '../_shared';
|
||||||
import { translateString, inEmbeddedApp, inSelectMediaEmbedMode, isSelectMediaMode, isShareMediaDisabled } from '../../utils/helpers/';
|
import { translateString, inEmbeddedApp, inSelectMediaEmbedMode, isSelectMediaMode } from '../../utils/helpers/';
|
||||||
|
|
||||||
class ProfileSearchBar extends React.PureComponent {
|
class ProfileSearchBar extends React.PureComponent {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -373,7 +373,6 @@ class NavMenuInlineTabs extends React.PureComponent {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const isSelectMediaMode = inSelectMediaEmbedMode();
|
const isSelectMediaMode = inSelectMediaEmbedMode();
|
||||||
const shareMediaDisabled = isShareMediaDisabled();
|
|
||||||
|
|
||||||
// Append action=select_media to links when in select mode
|
// Append action=select_media to links when in select mode
|
||||||
const mediaLink = isSelectMediaMode
|
const mediaLink = isSelectMediaMode
|
||||||
@@ -416,7 +415,7 @@ class NavMenuInlineTabs extends React.PureComponent {
|
|||||||
link={sharedByMeLink}
|
link={sharedByMeLink}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
{this.userIsAuthor && !shareMediaDisabled ? (
|
{this.userIsAuthor ? (
|
||||||
<InlineTab
|
<InlineTab
|
||||||
id="shared_with_me"
|
id="shared_with_me"
|
||||||
isActive={'shared_with_me' === this.props.type}
|
isActive={'shared_with_me' === this.props.type}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { ProfileMediaFilters } from '../components/search-filters/ProfileMediaFi
|
|||||||
import { ProfileMediaTags } from '../components/search-filters/ProfileMediaTags';
|
import { ProfileMediaTags } from '../components/search-filters/ProfileMediaTags';
|
||||||
import { ProfileMediaSharing } from '../components/search-filters/ProfileMediaSharing';
|
import { ProfileMediaSharing } from '../components/search-filters/ProfileMediaSharing';
|
||||||
import { ProfileMediaSorting } from '../components/search-filters/ProfileMediaSorting';
|
import { ProfileMediaSorting } from '../components/search-filters/ProfileMediaSorting';
|
||||||
import { inEmbeddedApp, inSelectMediaEmbedMode } from '../utils/helpers';
|
import { inEmbeddedApp, inSelectMediaEmbedMode, isShareMediaDisabled } from '../utils/helpers';
|
||||||
|
|
||||||
import { Page } from './_Page';
|
import { Page } from './_Page';
|
||||||
|
|
||||||
@@ -86,6 +86,7 @@ export class ProfileSharedWithMePage extends Page {
|
|||||||
let requestUrl = this.state.requestUrl;
|
let requestUrl = this.state.requestUrl;
|
||||||
|
|
||||||
if (author) {
|
if (author) {
|
||||||
|
const excludeLtiEmbed = isShareMediaDisabled() ? '&exclude_lti_embed=1' : '';
|
||||||
if (this.state.query) {
|
if (this.state.query) {
|
||||||
requestUrl =
|
requestUrl =
|
||||||
ApiUrlContext._currentValue.media +
|
ApiUrlContext._currentValue.media +
|
||||||
@@ -93,6 +94,7 @@ export class ProfileSharedWithMePage extends Page {
|
|||||||
author.id +
|
author.id +
|
||||||
'&show=shared_with_me&q=' +
|
'&show=shared_with_me&q=' +
|
||||||
encodeURIComponent(this.state.query) +
|
encodeURIComponent(this.state.query) +
|
||||||
|
excludeLtiEmbed +
|
||||||
this.state.filterArgs;
|
this.state.filterArgs;
|
||||||
} else {
|
} else {
|
||||||
requestUrl =
|
requestUrl =
|
||||||
@@ -100,6 +102,7 @@ export class ProfileSharedWithMePage extends Page {
|
|||||||
'?author=' +
|
'?author=' +
|
||||||
author.id +
|
author.id +
|
||||||
'&show=shared_with_me' +
|
'&show=shared_with_me' +
|
||||||
|
excludeLtiEmbed +
|
||||||
this.state.filterArgs;
|
this.state.filterArgs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -744,6 +744,7 @@ class EmbedMediaLTIView(View):
|
|||||||
defaults={
|
defaults={
|
||||||
'owner_user': media.user,
|
'owner_user': media.user,
|
||||||
'permission': 'viewer',
|
'permission': 'viewer',
|
||||||
|
'source': MediaPermission.SOURCE_LTI_EMBED,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
can_view = True
|
can_view = True
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user