mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 22:45:45 +01:00
introduce permission type without links
This commit is contained in:
@@ -3,12 +3,12 @@ import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { Checkbox, InputField } from "../../components/forms";
|
||||
import TypeSelector from "./TypeSelector";
|
||||
import type { Permission } from "../types/Permissions";
|
||||
import type {PermissionEntry} from "../types/Permissions";
|
||||
import { SubmitButton } from "../../components/buttons";
|
||||
|
||||
type Props = {
|
||||
t: string => string,
|
||||
createPermission: (permission: Permission) => void,
|
||||
createPermission: (permission: PermissionEntry) => void,
|
||||
loading: boolean
|
||||
};
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
} from "../modules/permissions";
|
||||
import Loading from "../../components/Loading";
|
||||
import ErrorPage from "../../components/ErrorPage";
|
||||
import type { Permission, PermissionCollection } from "../types/Permissions";
|
||||
import type {Permission, PermissionCollection, PermissionEntry} from "../types/Permissions";
|
||||
import SinglePermission from "./SinglePermission";
|
||||
import CreatePermissionForm from "../components/CreatePermissionForm";
|
||||
|
||||
@@ -29,7 +29,7 @@ type Props = {
|
||||
//dispatch functions
|
||||
fetchPermissions: (namespace: string, repoName: string) => void,
|
||||
createPermission: (
|
||||
permission: Permission,
|
||||
permission: PermissionEntry,
|
||||
namespace: string,
|
||||
repoName: string
|
||||
) => void,
|
||||
@@ -143,7 +143,7 @@ const mapDispatchToProps = dispatch => {
|
||||
dispatch(fetchPermissions(namespace, repoName));
|
||||
},
|
||||
createPermission: (
|
||||
permission: Permission,
|
||||
permission: PermissionEntry,
|
||||
namespace: string,
|
||||
repoName: string
|
||||
) => {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { apiClient } from "../../apiclient";
|
||||
import * as types from "../../modules/types";
|
||||
import type { Action } from "../../types/Action";
|
||||
import type { PermissionCollection, Permission } from "../types/Permissions";
|
||||
import type {PermissionCollection, Permission, PermissionEntry} from "../types/Permissions";
|
||||
import { isPending } from "../../modules/pending";
|
||||
import { getFailure } from "../../modules/failure";
|
||||
import { Dispatch } from "redux";
|
||||
@@ -206,7 +206,7 @@ export function modifyPermissionReset(
|
||||
|
||||
// create permission
|
||||
export function createPermission(
|
||||
permission: Permission,
|
||||
permission: PermissionEntry,
|
||||
namespace: string,
|
||||
repoName: string,
|
||||
callback?: () => void
|
||||
@@ -240,7 +240,7 @@ export function createPermission(
|
||||
}
|
||||
|
||||
export function createPermissionPending(
|
||||
permission: Permission,
|
||||
permission: PermissionEntry,
|
||||
namespace: string,
|
||||
repoName: string
|
||||
): Action {
|
||||
@@ -252,7 +252,7 @@ export function createPermissionPending(
|
||||
}
|
||||
|
||||
export function createPermissionSuccess(
|
||||
permission: Permission,
|
||||
permission: PermissionEntry,
|
||||
namespace: string,
|
||||
repoName: string
|
||||
): Action {
|
||||
|
||||
@@ -40,6 +40,9 @@ import reducer, {
|
||||
} from "./permissions";
|
||||
import type { Permission, PermissionCollection } from "../types/Permissions";
|
||||
|
||||
const namespace = "hitchhiker";
|
||||
const repoName = "puzzle42";
|
||||
|
||||
const hitchhiker_puzzle42Permission_user_eins: Permission = {
|
||||
name: "user_eins",
|
||||
type: "READ",
|
||||
@@ -115,7 +118,7 @@ describe("permission fetch", () => {
|
||||
{
|
||||
type: FETCH_PERMISSIONS_PENDING,
|
||||
payload: {
|
||||
namespace: "hitchhiker",
|
||||
namespace: namespace,
|
||||
repoName: "puzzle42"
|
||||
},
|
||||
itemId: "hitchhiker/puzzle42"
|
||||
|
||||
@@ -5,7 +5,13 @@ export type Permission = {
|
||||
name: string,
|
||||
type: string,
|
||||
groupPermission: boolean,
|
||||
_links?: Links
|
||||
_links: Links
|
||||
};
|
||||
|
||||
export type PermissionEntry = {
|
||||
name: string,
|
||||
type: string,
|
||||
groupPermission: boolean
|
||||
}
|
||||
|
||||
export type PermissionCollection = Permission[];
|
||||
|
||||
Reference in New Issue
Block a user