File: ags_business_group.c

package info (click to toggle)
gsequencer 7.7.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 71,040 kB
  • sloc: ansic: 1,145,949; xml: 31,016; cpp: 9,487; sh: 5,798; makefile: 3,845; perl: 155; sed: 16; python: 11
file content (244 lines) | stat: -rw-r--r-- 7,286 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
/* GSequencer - Advanced GTK Sequencer
 * Copyright (C) 2005-2019 Joël Krähemann
 *
 * This file is part of GSequencer.
 *
 * GSequencer is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * GSequencer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with GSequencer.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <ags/server/security/ags_business_group.h>

void ags_business_group_base_init(AgsBusinessGroupInterface *ginterface);

/**
 * SECTION:ags_business_group
 * @short_description: base group permissions
 * @title: AgsBusinessGroup
 * @section_id: AgsBusinessGroup
 * @include: ags/server/security/ags_business_group.h
 *
 * The #AgsBusinessGroup interface gives you base group permissions.
 */

GType
ags_business_group_get_type()
{
  static gsize g_define_type_id__static = 0;

  if(g_once_init_enter(&g_define_type_id__static)){
    GType ags_type_business_group = 0;

    static const GTypeInfo ags_business_group_info = {
      sizeof(AgsBusinessGroupInterface),
      (GBaseInitFunc) ags_business_group_base_init,
      NULL, /* base_finalize */
    };

    ags_type_business_group = g_type_register_static(G_TYPE_INTERFACE,
						     "AgsBusinessGroup", &ags_business_group_info,
						     0);

    g_once_init_leave(&g_define_type_id__static, ags_type_business_group);
  }

  return(g_define_type_id__static);
}

void
ags_business_group_base_init(AgsBusinessGroupInterface *ginterface)
{
  /* empty */
}

/**
 * ags_business_group_get_group_uuid:
 * @business_group: the #AgsBusinessGroup
 * @security_context: the #AgsSecurityContext
 * @user_uuid: the users unique identifier
 * @security_token: the security token
 * @error: the #GError-struct
 *
 * Get group UUID as string vector.
 * 
 * Returns: (element-type utf8) (array zero-terminated=1) (transfer full): the group UUIDs as %NULL terminated string array
 * 
 * Since: 3.0.0
 */
gchar**
ags_business_group_get_group_uuid(AgsBusinessGroup *business_group,
				  GObject *security_context,
				  gchar *user_uuid,
				  gchar *security_token,
				  GError **error)
{
  AgsBusinessGroupInterface *business_group_interface;

  g_return_val_if_fail(AGS_IS_BUSINESS_GROUP(business_group), NULL);
  business_group_interface = AGS_BUSINESS_GROUP_GET_INTERFACE(business_group);
  g_return_val_if_fail(business_group_interface->get_group_uuid, NULL);

  return(business_group_interface->get_group_uuid(business_group,
						  security_context,
						  user_uuid,
						  security_token,
						  error));
}

/**
 * ags_business_group_set_group_name:
 * @business_group: the #AgsBusinessGroup
 * @security_context: the #AgsSecurityContext
 * @user_uuid: the user's UUID
 * @security_token: the security token
 * @group_uuid: the group's UUID
 * @group_name: the business group's name to set
 * @error: the #GError-struct
 *
 * Set business group name.
 *
 * Since: 3.0.0
 */
void
ags_business_group_set_group_name(AgsBusinessGroup *business_group,
				  GObject *security_context,
				  gchar *user_uuid,
				  gchar *security_token,
				  gchar *group_uuid,
				  gchar *group_name,
				  GError **error)
{
  AgsBusinessGroupInterface *business_group_interface;

  g_return_if_fail(AGS_IS_BUSINESS_GROUP(business_group));
  business_group_interface = AGS_BUSINESS_GROUP_GET_INTERFACE(business_group);
  g_return_if_fail(business_group_interface->set_group_name);
  business_group_interface->set_group_name(business_group,
					   security_context,
					   user_uuid,
					   security_token,
					   group_uuid,
					   group_name,
					   error);
}

/**
 * ags_business_group_get_group_name:
 * @business_group: the #AgsBusinessGroup
 * @security_context: the #AgsSecurityContext
 * @user_uuid: the user's UUID
 * @security_token: the security token
 * @group_uuid: the group's UUID
 * @error: the #GError-struct
 *
 * Get business group name.
 *
 * Returns: the business group's name as string
 * 
 * Since: 3.0.0
 */
gchar*
ags_business_group_get_group_name(AgsBusinessGroup *business_group,
				  GObject *security_context,
				  gchar *user_uuid,
				  gchar *security_token,
				  gchar *group_uuid,
				  GError **error)
{
  AgsBusinessGroupInterface *business_group_interface;

  g_return_val_if_fail(AGS_IS_BUSINESS_GROUP(business_group), NULL);
  business_group_interface = AGS_BUSINESS_GROUP_GET_INTERFACE(business_group);
  g_return_val_if_fail(business_group_interface->get_group_name, NULL);

  return(business_group_interface->get_group_name(business_group,
						  security_context,
						  user_uuid,
						  security_token,
						  group_uuid,
						  error));
}

/**
 * ags_business_group_set_user:
 * @business_group: the #AgsBusinessGroup
 * @security_context: the #AgsSecurityContext
 * @user_uuid: the user's UUID
 * @security_token: the security token
 * @group_uuid: the business group's UUID
 * @user: (element-type utf8) (array zero-terminated=1): the string array containing user names
 * @error: the #GError-struct
 *
 * Set business group of user names as %NULL terminated string array.
 *
 * Since: 3.0.0
 */
void
ags_business_group_set_user(AgsBusinessGroup *business_group,
			    GObject *security_context,
			    gchar *user_uuid,
			    gchar *security_token,
			    gchar *group_uuid,
			    gchar **user,
			    GError **error)
{
  AgsBusinessGroupInterface *business_group_interface;

  g_return_if_fail(AGS_IS_BUSINESS_GROUP(business_group));
  business_group_interface = AGS_BUSINESS_GROUP_GET_INTERFACE(business_group);
  g_return_if_fail(business_group_interface->set_user);
  business_group_interface->set_user(business_group,
				     security_context,
				     user_uuid,
				     security_token,
				     group_uuid,
				     user,
				     error);
}

/**
 * ags_business_group_get_user:
 * @business_group: the #AgsBusinessGroup
 * @security_context: the #AgsSecurityContext
 * @user_uuid: the user's UUID
 * @security_token: the security token
 * @group_uuid: the business group's UUID
 * @error: the #GError-struct
 *
 * Get business group name as %NULL terminated string array.
 *
 * Returns: (element-type utf8) (array zero-terminated=1) (transfer full): the business group's user names as string vector
 * 
 * Since: 3.0.0
 */
gchar**
ags_business_group_get_user(AgsBusinessGroup *business_group,
			    GObject *security_context,
			    gchar *user_uuid,
			    gchar *security_token,
			    gchar *group_uuid,
			    GError **error)
{
  AgsBusinessGroupInterface *business_group_interface;

  g_return_val_if_fail(AGS_IS_BUSINESS_GROUP(business_group), NULL);
  business_group_interface = AGS_BUSINESS_GROUP_GET_INTERFACE(business_group);
  g_return_val_if_fail(business_group_interface->get_user, NULL);

  return(business_group_interface->get_user(business_group,
					    security_context,
					    user_uuid,
					    security_token,
					    group_uuid,
					    error));
}