You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.1 KiB

Restricted users (#6274) * Restricted users (#4334): initial implementation * Add User.IsRestricted & UI to edit it * Pass user object instead of user id to places where IsRestricted flag matters * Restricted users: maintain access rows for all referenced repos (incl public) * Take logged in user & IsRestricted flag into account in org/repo listings, searches and accesses * Add basic repo access tests for restricted users Signed-off-by: Manush Dodunekov <manush@stendahls.se> * Mention restricted users in the faq Signed-off-by: Manush Dodunekov <manush@stendahls.se> * Revert unnecessary change `.isUserPartOfOrg` -> `.IsUserPartOfOrg` Signed-off-by: Manush Dodunekov <manush@stendahls.se> * Remove unnecessary `org.IsOrganization()` call Signed-off-by: Manush Dodunekov <manush@stendahls.se> * Revert to an `int64` keyed `accessMap` * Add type `userAccess` * Add convenience func updateUserAccess() * Turn accessMap into a `map[int64]userAccess` Signed-off-by: Manush Dodunekov <manush@stendahls.se> * or even better: `map[int64]*userAccess` * updateUserAccess(): use tighter syntax as suggested by lafriks * even tighter * Avoid extra loop * Don't disclose limited orgs to unauthenticated users * Don't assume block only applies to orgs * Use an array of `VisibleType` for filtering * fix yet another thinko * Ok - no need for u * Revert "Ok - no need for u" This reverts commit 5c3e886aabd5acd997a3b35687d322439732c200. Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv>
4 years ago
Restricted users (#6274) * Restricted users (#4334): initial implementation * Add User.IsRestricted & UI to edit it * Pass user object instead of user id to places where IsRestricted flag matters * Restricted users: maintain access rows for all referenced repos (incl public) * Take logged in user & IsRestricted flag into account in org/repo listings, searches and accesses * Add basic repo access tests for restricted users Signed-off-by: Manush Dodunekov <manush@stendahls.se> * Mention restricted users in the faq Signed-off-by: Manush Dodunekov <manush@stendahls.se> * Revert unnecessary change `.isUserPartOfOrg` -> `.IsUserPartOfOrg` Signed-off-by: Manush Dodunekov <manush@stendahls.se> * Remove unnecessary `org.IsOrganization()` call Signed-off-by: Manush Dodunekov <manush@stendahls.se> * Revert to an `int64` keyed `accessMap` * Add type `userAccess` * Add convenience func updateUserAccess() * Turn accessMap into a `map[int64]userAccess` Signed-off-by: Manush Dodunekov <manush@stendahls.se> * or even better: `map[int64]*userAccess` * updateUserAccess(): use tighter syntax as suggested by lafriks * even tighter * Avoid extra loop * Don't disclose limited orgs to unauthenticated users * Don't assume block only applies to orgs * Use an array of `VisibleType` for filtering * fix yet another thinko * Ok - no need for u * Revert "Ok - no need for u" This reverts commit 5c3e886aabd5acd997a3b35687d322439732c200. Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv>
4 years ago
  1. {{template "base/head" .}}
  2. <div class="admin user">
  3. {{template "admin/navbar" .}}
  4. <div class="ui container">
  5. {{template "base/alert" .}}
  6. <h4 class="ui top attached header">
  7. {{.i18n.Tr "admin.users.user_manage_panel"}} ({{.i18n.Tr "admin.total" .Total}})
  8. <div class="ui right">
  9. <a class="ui blue tiny button" href="{{AppSubUrl}}/admin/users/new">{{.i18n.Tr "admin.users.new_account"}}</a>
  10. </div>
  11. </h4>
  12. <div class="ui attached segment">
  13. {{template "admin/base/search" .}}
  14. </div>
  15. <div class="ui attached table segment">
  16. <table class="ui very basic striped table">
  17. <thead>
  18. <tr>
  19. <th>ID</th>
  20. <th>{{.i18n.Tr "admin.users.name"}}</th>
  21. <th>{{.i18n.Tr "email"}}</th>
  22. <th>{{.i18n.Tr "admin.users.activated"}}</th>
  23. <th>{{.i18n.Tr "admin.users.admin"}}</th>
  24. <th>{{.i18n.Tr "admin.users.restricted"}}</th>
  25. <th>{{.i18n.Tr "admin.users.repos"}}</th>
  26. <th>{{.i18n.Tr "admin.users.created"}}</th>
  27. <th>{{.i18n.Tr "admin.users.last_login"}}</th>
  28. <th>{{.i18n.Tr "admin.users.edit"}}</th>
  29. </tr>
  30. </thead>
  31. <tbody>
  32. {{range .Users}}
  33. <tr>
  34. <td>{{.ID}}</td>
  35. <td><a href="{{AppSubUrl}}/{{.Name}}">{{.Name}}</a></td>
  36. <td><span class="text truncate email">{{.Email}}</span></td>
  37. <td><i class="fa fa{{if .IsActive}}-check{{end}}-square-o"></i></td>
  38. <td><i class="fa fa{{if .IsAdmin}}-check{{end}}-square-o"></i></td>
  39. <td><i class="fa fa{{if .IsRestricted}}-check{{end}}-square-o"></i></td>
  40. <td>{{.NumRepos}}</td>
  41. <td><span title="{{.CreatedUnix.FormatLong}}">{{.CreatedUnix.FormatShort}}</span></td>
  42. {{if .LastLoginUnix}}
  43. <td><span title="{{.LastLoginUnix.FormatLong}}">{{.LastLoginUnix.FormatShort}}</span></td>
  44. {{else}}
  45. <td><span>{{$.i18n.Tr "admin.users.never_login"}}</span></td>
  46. {{end}}
  47. <td><a href="{{$.Link}}/{{.ID}}"><i class="fa fa-pencil-square-o"></i></a></td>
  48. </tr>
  49. {{end}}
  50. </tbody>
  51. </table>
  52. </div>
  53. {{template "base/paginate" .}}
  54. </div>
  55. </div>
  56. {{template "base/footer" .}}