-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Site admin cleanup #220
Site admin cleanup #220
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neviem preco chytas tie nie admin policy nedava mi to zmysel
app/policies/message_draft_policy.rb
Outdated
if @user.admin? | ||
return scope.where( | ||
MessageDraft | ||
.joins(thread: :box) | ||
.where(box: { tenant_id: Current.tenant.id }) | ||
.arel.exists | ||
) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Toto je co za novu logiku?
if @user.admin? | ||
return scope.where( | ||
MessageObject | ||
.joins(message: { thread: :box }) | ||
.where(box: { tenant_id: Current.tenant.id }) | ||
.arel.exists | ||
) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nerozumiem uplne preco sa chytame message_object policy ak riesime administraciu.
app/policies/message_policy.rb
Outdated
if @user.admin? | ||
return scope.where( | ||
Message | ||
.joins(thread: :box) | ||
.where(box: { tenant_id: Current.tenant.id }) | ||
.arel.exists | ||
) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Toto je tiez divne.
Neotvori toto pandorinu skrinku, ze hocikto moze pomenit pravidla a filtre hocikomu? |
Pre pravidla nie - tam je to obmedzene, ze kazdy ma svoje. Filtre maju tiez obmedzenie na autora, ak nie si admin. Ale iba pri akcii index. T.j. bokom sa to asi nejako da oklamat (uz teraz) |
Ok toto dava zmysel, ale teda plati, ze admin vidi vsetky pravidla potom? (A nevidi kto ich vyrobil? site_admin feeling again) |
Aktualne tak ako pises, t.j. admin vidi vsetky, ale nevie, cie je. To tam doriesim. |
Mne to vychadza tak, ze proste potrebujeme jednu sekciu na administraciu a jednu na "moje veci". Spajat to nedava uplne zmysel. |
end | ||
end | ||
|
||
def index? | ||
Current.tenant.feature_enabled?(:audit_log) && (@user.site_admin? || @user.admin?) | ||
Current.tenant.feature_enabled?(:audit_log) && @user.admin? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aj toto rozdelme na dva riadky. Potom len feature flag odmazeme
scope_tags_to_accessible_by_user(scope) | ||
end | ||
|
||
def scope_tags_to_accessible_by_user(scope) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Toto bolo tak pekne nazvane a uz vlastne nevies velmi co to robi. Cize v klude tu metodu nechajme a zavolajme len ju hore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Este mala vec
Ked som upratoval lave menu, zistil som, ze bezny user dnes nemoze manazovat filtre ani pravidla. Povodny zamer bol, ze obe by mal. Umoznime?