chore: Backport fixes

Signed-off-by: Louis Chemineau <louis@chmn.me>
This commit is contained in:
Louis Chemineau 2025-04-01 14:16:24 +02:00
parent 9cac8217c3
commit fcd5da101f
No known key found for this signature in database
12 changed files with 344 additions and 15 deletions

View file

@ -3593,6 +3593,168 @@
}
}
},
"/ocs/v2.php/cloud/users/{userId}/groups/details": {
"get": {
"operationId": "users-get-users-groups-details",
"summary": "Get a list of groups with details",
"tags": [
"users"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "userId",
"in": "path",
"description": "ID of the user",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "Users groups returned",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
"type": "object",
"required": [
"groups"
],
"properties": {
"groups": {
"type": "array",
"items": {
"$ref": "#/components/schemas/GroupDetails"
}
}
}
}
}
}
}
}
}
}
}
}
}
},
"/ocs/v2.php/cloud/users/{userId}/subadmins/details": {
"get": {
"operationId": "users-get-user-sub-admin-groups-details",
"summary": "Get a list of the groups the user is a subadmin of, with details",
"tags": [
"users"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "userId",
"in": "path",
"description": "ID of the user",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "Users subadmin groups returned",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
"type": "object",
"required": [
"groups"
],
"properties": {
"groups": {
"type": "array",
"items": {
"$ref": "#/components/schemas/GroupDetails"
}
}
}
}
}
}
}
}
}
}
}
}
}
},
"/ocs/v2.php/cloud/users/{userId}/welcome": {
"post": {
"operationId": "users-resend-welcome-message",

View file

@ -2530,6 +2530,168 @@
}
}
},
"/ocs/v2.php/cloud/users/{userId}/groups/details": {
"get": {
"operationId": "users-get-users-groups-details",
"summary": "Get a list of groups with details",
"tags": [
"users"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "userId",
"in": "path",
"description": "ID of the user",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "Users groups returned",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
"type": "object",
"required": [
"groups"
],
"properties": {
"groups": {
"type": "array",
"items": {
"$ref": "#/components/schemas/GroupDetails"
}
}
}
}
}
}
}
}
}
}
}
}
}
},
"/ocs/v2.php/cloud/users/{userId}/subadmins/details": {
"get": {
"operationId": "users-get-user-sub-admin-groups-details",
"summary": "Get a list of the groups the user is a subadmin of, with details",
"tags": [
"users"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "userId",
"in": "path",
"description": "ID of the user",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "OCS-APIRequest",
"in": "header",
"description": "Required to be true for the API request to pass",
"required": true,
"schema": {
"type": "boolean",
"default": true
}
}
],
"responses": {
"200": {
"description": "Users subadmin groups returned",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {
"type": "object",
"required": [
"groups"
],
"properties": {
"groups": {
"type": "array",
"items": {
"$ref": "#/components/schemas/GroupDetails"
}
}
}
}
}
}
}
}
}
}
}
}
}
},
"/ocs/v2.php/cloud/users/{userId}/welcome": {
"post": {
"operationId": "users-resend-welcome-message",

View file

@ -134,7 +134,7 @@ class UsersController extends Controller {
$adminGroupData = [
'id' => $adminGroup->getGID(),
'name' => $adminGroup->getDisplayName(),
'usercount' => $sortGroupsBy === MetaData::SORT_USERCOUNT ? $adminGroup->count() : 0,
'usercount' => $sortGroupsBy === \OC\Group\MetaData::SORT_USERCOUNT ? $adminGroup->count() : 0,
'disabled' => $adminGroup->countDisabled(),
'canAdd' => $adminGroup->canAddUser(),
'canRemove' => $adminGroup->canRemoveUser(),

View file

@ -73,7 +73,8 @@
:required="!settings.isAdmin && !settings.isDelegatedAdmin"
:create-option="(value) => ({ id: value, name: value, isCreating: true })"
@search="searchGroups"
@option:created="createGroup" />
@option:created="createGroup"
@option:selected="options => addGroup(options.at(-1))" />
<!-- If user is not admin, he is a subadmin.
Subadmins can't create users outside their groups
Therefore, empty select is forbidden -->

View file

@ -26,6 +26,14 @@ export default {
default: () => [],
},
},
data() {
return {
availableGroups: this.user.groups.map(id => ({ id, name: id })),
availableSubAdminGroups: this.user.subadmin.map(id => ({ id, name: id })),
userGroups: this.user.groups.map(id => ({ id, name: id })),
userSubAdminGroups: this.user.subadmin.map(id => ({ id, name: id })),
}
},
computed: {
showConfig() {
return this.$store.getters.getShowConfig

View file

@ -101,17 +101,13 @@ import { mdiAccount, mdiAccountOff, mdiCog, mdiPlus, mdiShieldAccount, mdiHistor
import { translate as t } from '@nextcloud/l10n'
import { computed, ref } from 'vue'
import NcActionInput from '@nextcloud/vue/dist/Components/NcActionInput.js'
import NcActionText from '@nextcloud/vue/dist/Components/NcActionText.js'
import NcAppNavigation from '@nextcloud/vue/dist/Components/NcAppNavigation.js'
import NcAppNavigationCaption from '@nextcloud/vue/dist/Components/NcAppNavigationCaption.js'
import NcAppNavigationItem from '@nextcloud/vue/dist/Components/NcAppNavigationItem.js'
import NcAppNavigationList from '@nextcloud/vue/dist/Components/NcAppNavigationList.js'
import NcAppNavigationNew from '@nextcloud/vue/dist/Components/NcAppNavigationNew.js'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcCounterBubble from '@nextcloud/vue/dist/Components/NcCounterBubble.js'
import NcIconSvgWrapper from '@nextcloud/vue/dist/Components/NcIconSvgWrapper.js'
import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
import UserSettingsDialog from '../components/Users/UserSettingsDialog.vue'
import AppNavigationGroupList from '../components/AppNavigationGroupList.vue'

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long