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

feat: default user role #5872

Merged
merged 4 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/spicy-drinks-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@logto/console": minor
"@logto/phrases": minor
"@logto/schemas": minor
"@logto/core": minor
---

support default roles for users
2 changes: 1 addition & 1 deletion packages/app-insights/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
},
"prettier": "@silverhand/eslint-config/.prettierrc",
"dependencies": {
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"applicationinsights": "^2.9.5"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@logto/phrases-experience": "workspace:^1.6.1",
"@logto/schemas": "workspace:1.16.0",
"@logto/shared": "workspace:^3.1.1",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"@silverhand/slonik": "31.0.0-beta.2",
"chalk": "^5.0.0",
"decamelize": "^6.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/database/alteration/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { AlterationScript } from '@logto/schemas/lib/types/alteration.js';
import { conditionalString } from '@silverhand/essentials';
import type { DatabasePool } from '@silverhand/slonik';
import type { CommonQueryMethods, DatabasePool } from '@silverhand/slonik';
import chalk from 'chalk';
import type { CommandModule } from 'yargs';

Expand Down Expand Up @@ -39,7 +39,7 @@ export const getLatestAlterationTimestamp = async () => {
};

export const getAvailableAlterations = async (
pool: DatabasePool,
pool: CommonQueryMethods,
compareMode: 'gt' | 'lte' = 'gt'
) => {
const databaseTimestamp = await getCurrentDatabaseAlterationTimestamp(pool);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/translate/sync-keys/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ const traverseNode = async (
await traverseObject(baseline, targetObject, 2);

await (isRoot
? fs.appendFile(targetFilePath, '} satisfies LocalePhrase;\n\n')
? fs.appendFile(targetFilePath, '} satisfies DeepPartial<LocalePhrase>;\n\n')
: fs.appendFile(targetFilePath, '};\n\n'));
await fs.appendFile(targetFilePath, `export default Object.freeze(${identifier});\n`);
};
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-alipay-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Silverhand Inc. <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"dayjs": "^1.10.5",
"got": "^14.0.0",
"iconv-lite": "^0.6.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-alipay-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Alipay implementation.",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"dayjs": "^1.10.5",
"got": "^14.0.0",
"iconv-lite": "^0.6.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-aliyun-dm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Aliyun DM connector implementation.",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-aliyun-sms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Aliyun SMS connector implementation.",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-apple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@logto/shared": "workspace:^3.1.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"jose": "^5.0.0",
"snakecase-keys": "^8.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-aws-ses/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"@aws-sdk/client-sesv2": "^3.556.0",
"@aws-sdk/types": "^3.535.0",
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-azuread/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dependencies": {
"@azure/msal-node": "^2.0.0",
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-discord/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "ZR3SYSTEMS. <https://github.com/FlurryNight>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-facebook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Silverhand Inc. <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-feishu-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Silverhand Inc. <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-github/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Silverhand Inc. <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"ky": "^1.2.3",
"query-string": "^9.0.0",
"snakecase-keys": "^8.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-google/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Silverhand Inc. <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-huggingface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@logto/connector-oauth": "workspace:^1.3.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"ky": "^1.2.3",
"zod": "^3.22.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-kakao/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Kyungyoon Kim. <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-logto-email/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Silverhand Inc. <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-logto-sms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Silverhand Inc. <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Silverhand Inc. <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-mailgun/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Silverhand Inc. <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Silverhand Inc. <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-mock-email/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Silverhand Inc. <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-mock-sms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Silverhand Inc. <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-mock-social/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Silverhand Inc. <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-naver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Kyungyoon Kim. <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-oauth2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@logto/shared": "workspace:^3.1.1",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"jose": "^5.0.0",
"ky": "^1.2.3",
"query-string": "^9.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-oidc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@logto/connector-kit": "workspace:^3.0.0",
"@logto/connector-oauth": "workspace:^1.3.0",
"@logto/shared": "workspace:^3.1.1",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"jose": "^5.0.0",
"ky": "^1.2.3",
"nanoid": "^5.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-saml/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Silverhand Inc. <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"fast-xml-parser": "^4.3.6",
"got": "^14.0.0",
"samlify": "2.8.11",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Silverhand Inc. <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-smsaero/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Danil Tankov <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-smtp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Silverhand Inc. <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"nodemailer": "^6.9.9",
"snakecase-keys": "^8.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-tencent-sms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "StringKe",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-twilio-sms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Silverhand Inc. <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-wechat-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Silverhand Inc. <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-wechat-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Silverhand Inc. <[email protected]>",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/connectors/connector-wecom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Dove<[email protected]> fork from Wechat Web connector",
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"got": "^14.0.0",
"snakecase-keys": "^8.0.0",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@parcel/transformer-svg-react": "2.9.3",
"@silverhand/eslint-config": "6.0.1",
"@silverhand/eslint-config-react": "6.0.2",
"@silverhand/essentials": "^2.9.0",
"@silverhand/essentials": "^2.9.1",
"@silverhand/ts-config": "6.0.0",
"@silverhand/ts-config-react": "6.0.0",
"@swc/core": "^1.3.52",
Expand Down
11 changes: 10 additions & 1 deletion packages/console/src/pages/RoleDetails/RoleSettings/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Role } from '@logto/schemas';
import { RoleType, type Role } from '@logto/schemas';
import { useForm } from 'react-hook-form';
import { toast } from 'react-hot-toast';
import { useTranslation } from 'react-i18next';
Expand All @@ -8,6 +8,7 @@ import DetailsForm from '@/components/DetailsForm';
import FormCard from '@/components/FormCard';
import UnsavedChangesAlertModal from '@/components/UnsavedChangesAlertModal';
import FormField from '@/ds-components/FormField';
import Switch from '@/ds-components/Switch';
import TextInput from '@/ds-components/TextInput';
import useApi from '@/hooks/use-api';
import { trySubmitSafe } from '@/utils/form';
Expand Down Expand Up @@ -66,6 +67,14 @@ function RoleSettings() {
error={Boolean(errors.description)}
/>
</FormField>
{role.type === RoleType.User && (
<FormField title="role_details.field_is_default">
<Switch
label={t('role_details.field_is_default_description')}
{...register('isDefault')}
/>
</FormField>
)}
</FormCard>
</DetailsForm>
<UnsavedChangesAlertModal hasUnsavedChanges={!isDeleting && isDirty} />
Expand Down
Loading
Loading