mirror of
https://github.com/outline/outline.git
synced 2026-11-22 14:01:41 +03:00
This change adds an admin role to GroupUser that allows group admins to: 1. Administer other users in the group 2. Change the group name Changes include: - Database migration to add isAdmin field to group_users table - Updated GroupUser model to include isAdmin field - Added isGroupAdmin policy utility function - Updated group policy to allow group admins to update groups - Added API endpoints for managing admin status - Updated GroupUsersStore to handle admin functionality - Added tests for the new functionality
31 lines
678 B
TypeScript
31 lines
678 B
TypeScript
import Group from "./Group";
|
|
import User from "./User";
|
|
import Model from "./base/Model";
|
|
import Relation from "./decorators/Relation";
|
|
|
|
/**
|
|
* Represents a user's membership to a group.
|
|
*/
|
|
class GroupUser extends Model {
|
|
static modelName = "GroupUser";
|
|
|
|
/** The ID of the user. */
|
|
userId: string;
|
|
|
|
/** The user that belongs to the group. */
|
|
@Relation(() => User, { onDelete: "cascade" })
|
|
user: User;
|
|
|
|
/** The ID of the group. */
|
|
groupId: string;
|
|
|
|
/** The group that the user belongs to. */
|
|
@Relation(() => Group, { onDelete: "cascade" })
|
|
group: Group;
|
|
|
|
/** Whether the user is an admin of the group. */
|
|
isAdmin: boolean;
|
|
}
|
|
|
|
export default GroupUser;
|