Skip to content
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

add readonly mode #406

Merged
merged 11 commits into from
Sep 11, 2023
Merged

add readonly mode #406

merged 11 commits into from
Sep 11, 2023

Conversation

robkooper
Copy link
Member

tested with create spaces/datasets/files but might be missing special cases. fixes #405

Description

A request was made to be able to mark users as read-only. They should not be able to create new spaces, or anything else. All they can do is view things.

Use 2 users, an admin user and set the second user to readonly

See if the readonly user can do any write operations, create spaces/datasets/collections/files/tags/comments etc.

Review Time Estimate

  • Immediately
  • Within one week
  • When possible

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the CHANGELOG.md.
  • I have signed the CLA
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

tested with create spaces/datasets/files but might be missing special cases.
fixes #405
@max-zilla
Copy link
Contributor

tested this, was able to create a dataset using Create Dataset button on the explore page when logged in as user with status set to ReadOnly (db.social.users.update({ "_id" : ObjectId("64248e486635dbcac3f867ab")}, {$set: {"status": "ReadOnly"}});)

Copy link
Contributor

@max-zilla max-zilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still some buttons on Explore UI that allow creation of new resources.

Copy link
Member

@lmarini lmarini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a few more links in a couple of places:

  • Dashboard at the top Create Space / Dataset Collection
  • Dashboard My Spaces tab and My Collection tab
  • Profile page, Spaces and Collections tabs (might be same template as dashboard)
  • Selections, Delete All / Tag all

Left two other comments inline.

app/views/admin/users.scala.html Outdated Show resolved Hide resolved
case Some(resource) if Permission.checkOwner(u, resource) => block(userRequest)
case _ => Future.successful(Unauthorized("Not authorized"))
}
if(u.status == UserStatus.ReadOnly && !api.Permission.READONLY.contains(permission)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to add this logic to controllers.SecuredController.PermissionAction to lock pages like /datasets/new

@lmarini lmarini self-requested a review September 11, 2023 19:57
@lmarini lmarini merged commit e57bf56 into develop Sep 11, 2023
6 checks passed
@lmarini lmarini deleted the readonly-mode branch September 11, 2023 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ability to have users be read-only
3 participants