<commit_before>/**
 * @license
 * Copyright 2018 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

foam.INTERFACE({
  package: 'foam.nanos.auth',
  name: 'AgentAuthService',

  documentation: `
    The agent auth service is responsible for allowing users to act as
    others if permitted and places the requesting user as an agent of the system within the context.
    A junction between users are created to determine if a user is permitted to act as another user.
    Along with the target & source Id on the junction object (UserUserJunction), a group is
    appended and is used to determine the list of permissions for the current user agent
    access to the system. When acting as another user, the user requesting to act is an "agent"
    within the context. The user being acted as becomes the "user" within the context, and
    the group associated to the junction object is associated to the "user" within the context.
  `,


  methods: [
    {
      name: 'actAs',
      javaReturns: 'foam.nanos.auth.User',
      swiftReturns: 'foam_nanos_auth_User',
      javaThrows: [
        'foam.nanos.auth.AuthorizationException',
        'foam.nanos.auth.AuthenticationException'
      ],
      swiftThrows: true,
      args: [
        {
          name: 'x',
          javaType: 'foam.core.X',
          swiftType: 'Context'
        },
        {
          name: 'entity',
          javaType: 'foam.nanos.auth.User'
        }
      ]
    },
    {
      name: 'canActAs',
      documentation: `Returns a boolean indicating whether the provided agent has adequate permission to actAs the provided entity.`,
      javaReturns: 'boolean',
      swiftReturns: 'Bool',
      javaThrows: [
        'foam.nanos.auth.AuthorizationException',
        'foam.nanos.auth.AuthenticationException'
      ],
      swiftThrows: true,
      args: [
        {
          name: 'x',
          javaType: 'foam.core.X',
          swiftType: 'Context'
        },
        {
          name: 'agent',
          javaType: 'foam.nanos.auth.User'
        },
        {
          name: 'entity',
          javaType: 'foam.nanos.auth.User'
        }
      ]<commit_msg>Remove redunant javaThrows from canActAs<commit_after>/**
 * @license
 * Copyright 2018 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

foam.INTERFACE({
  package: 'foam.nanos.auth',
  name: 'AgentAuthService',

  documentation: `
    The agent auth service is responsible for allowing users to act as
    others if permitted and places the requesting user as an agent of the system within the context.
    A junction between users are created to determine if a user is permitted to act as another user.
    Along with the target & source Id on the junction object (UserUserJunction), a group is
    appended and is used to determine the list of permissions for the current user agent
    access to the system. When acting as another user, the user requesting to act is an "agent"
    within the context. The user being acted as becomes the "user" within the context, and
    the group associated to the junction object is associated to the "user" within the context.
  `,


  methods: [
    {
      name: 'actAs',
      javaReturns: 'foam.nanos.auth.User',
      swiftReturns: 'foam_nanos_auth_User',
      javaThrows: [
        'foam.nanos.auth.AuthorizationException',
        'foam.nanos.auth.AuthenticationException'
      ],
      swiftThrows: true,
      args: [
        {
          name: 'x',
          javaType: 'foam.core.X',
          swiftType: 'Context'
        },
        {
          name: 'entity',
          javaType: 'foam.nanos.auth.User'
        }
      ]
    },
    {
      name: 'canActAs',
      documentation: `Returns a boolean indicating whether the provided agent has adequate permission to actAs the provided entity.`,
      javaReturns: 'boolean',
      swiftReturns: 'Bool',
      swiftThrows: true,
      args: [
        {
          name: 'x',
          javaType: 'foam.core.X',
          swiftType: 'Context'
        },
        {
          name: 'agent',
          javaType: 'foam.nanos.auth.User'
        },
        {
          name: 'entity',
          javaType: 'foam.nanos.auth.User'
        }
      ]
{'fraction_non_alphanumeric': 0.09229685298262096, 'fraction_numerical': 0.0028182245185533112, 'mean_word_length': 2.2167673716012084, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2125241', 'n_tokens_mistral': 1215, 'n_tokens_neox': 1190, 'n_words': 413}