我需要创建一个系统,根据用户在"导演"中选择的时间,从用户列表中启用和禁用特定用户的app中的按钮。角色。
导演可以选择为基本用户启用模板的每一天:
<template name="showSend">
<h4>Send Notification to: {{data.profile.lastName}} {{data.profile.firstName}}</h4>
<form>
<select name="notification">
<option value="1day">1 day</option>
<option value="3day">3 days</option>
<option value="5day">5 days</option>
<option value="week">1 week</option>
</select>
<br><br>
<label><input type="submit" name={{data.profile.lastName}} id="sendQuest" ><span><i class="fa fa-bell" aria-hidden="true"></i> Send</span></label>
</form>
</template>
另一方面,用户看到按钮:
<template name="dashboard">
...
<button type="submit" class="btn btn-primary" id="yes">Yes</button>
...
</template>
我的用户集合是:
Schemas.UserProfile = new SimpleSchema(
firstName:
type: String
optional: true
lastName:
type: String
optional: true
personNumber:
type: String
optional: true
birthday:
type: Date
optional: true
location:
type: String
optional: true
country:
type: String
label: 'Nationality'
allowedValues: Utils.countryList
optional: true
clinic:
type: String
label: 'Clinic'
allowedValues: Utils.clinicList
optional: true
)
Schemas.User = new SimpleSchema(
username:
type: String
regEx: /^[a-z0-9A-Z_]{3,15}$/
optional: true
emails:
type: [Object]
optional: true
"emails.$.address":
type: String
regEx: SimpleSchema.RegEx.Email
"emails.$.verified":
type: Boolean
createdAt:
type: Date
profile:
type: Schemas.UserProfile
optional: true
services:
type: Object
optional: true
blackbox: true
roles:
type: [String]
blackbox: true
optional: true
)
答案 0 :(得分:0)
注意:强>
基于以上所述,我无法分享任何特定代码,但会尝试指出正确的方向,以便让您开始使用此代码。
到目前为止,我的理解是:
您的方法可能如下所示:
Schemas.UserProfile
中使用到期日期时间戳创建一个新字段(您可以通过添加到期时间来计算此字段)当前时间到达将来禁用按钮的时间)或者,您可以将此数据保存在新的集合中(可能包含用户ID与到期时间)